Lawrence Bottorff writes:
> So I can run code for a REPL-type language like Clojure in a babel code
> block and get "results," e.g., a Clojure code block takes in a vector of
> mappings and produces new "results":
> | :name | head | :size | 3 |
> | :name | left-eye | :size | 1 |
> | :name | right-eye | :size | 1 |
> | :name | left-ear | :size | 1 |
> . . .
> but could I generate results that aren't just static output listed after a
> #+RESULTS tag, rather, embedded in a newly created babel code block? I'd
> like such output "initialized" as far as the running REPL is concerned too.
> Is it possible to generate new code/data that is immediately known to the
> REPL session? Any examples don't have to be Clojure.
You can use the :session header argument which will give you access to
any variables created during the session:
You can pass the function results to a variable argument, which makes
possible chaining (see http://www.jstatsoft.org/v46/i03):
#+header: :var x=myfunc(2)
You can also embed and call a function in a source code block using noweb
Thomas S. Dye