How to import/expand noweb refs in evaluated (exported) source blocks in org-babel?

emacs, literate-programming, org-babel, org-mode, reproducible-research

Solution

I'm not sure to really understand your point... but

1) you miss a `noweb:yes` header argument

2) you can use `<<func()>>` to insert the results of evaluating func (instead of the code of func) -- that's here that I'm not sure about what you really want.

Problem

I'm trying to do something like this: ``` * Define some functions #+begin_src python :noweb_ref defs def f1(a,b,c): return True def f2(d,e,f): return False #+end_src * Use them in a results-exported block later #+begin_src python :results output :exports both :tangle yes <<defs>> print "test results:" print f1(1,2,3) #end_src ``` What I want to happen is for <<defs>> to be expanded tangle-style when the block is evaluated to produce the export output. What actually happens is that <<defs>> gets evaluated literally and causes a syntax error. When tangling blocks like this to an output file, everything works perfectly, but I can't figure out how to do the same thing when I'm exporting the buffer. Suggestions?

Original source