From: Lawrence Bottorff <borgauf@gmail.com>
To: emacs-orgmode Mailinglist <emacs-orgmode@gnu.org>
Subject: Calling/using named babel code blocks
Date: Wed, 18 Dec 2019 11:10:49 -0600 [thread overview]
Message-ID: <CAFAhFSUS56h-DYR_PpBcvxF9n8OCpc8FdKAx7nxYnrEphrJw9w@mail.gmail.com> (raw)
[-- 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 --]
next reply other threads:[~2019-12-18 17:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-18 17:10 Lawrence Bottorff [this message]
2019-12-18 18:03 ` Calling/using named babel code blocks Berry, Charles
2019-12-18 18:33 ` John Kitchin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFAhFSUS56h-DYR_PpBcvxF9n8OCpc8FdKAx7nxYnrEphrJw9w@mail.gmail.com \
--to=borgauf@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).