emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Calling/using named babel code blocks


From: Lawrence Bottorff
Subject: Calling/using named babel code blocks
Date: Wed, 18 Dec 2019 11:10:49 -0600

I thought I understood "metaprogramming," i.e., creating generic code blocks that can be called by any other code block regardless of programming language -- but apparently I don't. I have this

 #+name: my-random-gen
#+header: :var n=0 :var lim=0
#+BEGIN_SRC emacs-lisp
(loop repeat n collect (random* lim))
#+END_SRC

and I have the variables initialized to zero. But now I don't know how to call it with another code block. I've tried various versions of this

#+BEGIN_SRC emacs-lisp
my-random-gen(5 1.0)
#+END_SRC

and this various versions of this

#+BEGIN_SRC emacs-lisp :var results=my-random-gen() :var n=5 :var lim=1.0
results
#+END_SRC

to no avail. What am I missing? How can I actually use, call my-random-gen in other code blocks?

LB



reply via email to

[Prev in Thread] Current Thread [Next in Thread]