emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Calling/using named babel code blocks
@ 2019-12-18 17:10 Lawrence Bottorff
  2019-12-18 18:03 ` Berry, Charles
  2019-12-18 18:33 ` John Kitchin
  0 siblings, 2 replies; 3+ messages in thread
From: Lawrence Bottorff @ 2019-12-18 17:10 UTC (permalink / raw)
  To: emacs-orgmode Mailinglist

[-- Attachment #1: Type: text/plain, Size: 748 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1367 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-18 18:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-18 17:10 Calling/using named babel code blocks Lawrence Bottorff
2019-12-18 18:03 ` Berry, Charles
2019-12-18 18:33 ` John Kitchin

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).