Hi Eric,

schulte.e...@gmail.com writes:

>> What I don't understand is:
>> - how to define this function;
>
> It is not a function name, it is a code block name.  See the noweb
> section of the Org-mode manual for more information.

OK.

>> - will it be evaluated as a "mylang" function or as a function in the
>> language it is defined?
>>
>> In other words, do we have "evaluate elisp-conversion-to-mylang in its
>> language then substitute the results in the noweb block" or "substitute
>> the function in the noweb block then evaluate it"?
>>
>
> see above

I'm sorry, I don't see the answer to this above. The only example I
could find in the manual is this one
http://orgmode.org/manual/noweb_002dref.html#noweb_002dref which does
not address using noweb with different languages.

I did some experiments and I'm even more confused. Here is a test where
I want to feed the results of "ls" in a shell block as an ocaml
list. This is what I tried:

--8<---------------cut here---------------start------------->8---
#+BEGIN_SRC sh :noweb-ref testing
echo "["
for i in `ls`; do
  echo \"$i;\"
done
echo "]"
#+END_SRC

#+BEGIN_SRC ocaml :noweb yes
let x =
<<testing>>
in x
#+END_SRC
--8<---------------cut here---------------end--------------->8---

This is clearly wrong because this is what ends up in the toplevel:

--8<---------------cut here---------------start------------->8---
let x =
echo "["
for i in `ls`; do
  echo \"$i;\"
done
echo "]"
in x;;
--8<---------------cut here---------------end--------------->8---

(I would have like the code to be executed, and the raw results to
replace the <<testing>> ref.)

So I'll rephrase my question: how can I use noweb with different
languages?

Thanks,

Alan

Reply via email to