emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How do you use call and lob in org-babel?
@ 2010-08-05 13:24 Inquisitive Scientist
  2010-08-05 17:02 ` Dan Davison
  0 siblings, 1 reply; 3+ messages in thread
From: Inquisitive Scientist @ 2010-08-05 13:24 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 555 bytes --]

Dear Experts,

I am confused about how to use lob and call in org-babel. First I
define a simple function like square:
#+srcname: square(x)
#+begin_src python
return x*x
#+end_src

A line like
: #+lob: square(x=2)
does not seem to produce any result either in the buffer or on export:
#+lob: square(x=2)

The same seems to happen with call:
: #+call: square(x=2)
#+call: square(x=2)

Instead, to get things to work I need to do something like:
: | 4 |
: #+TBLFM: @1$1='(sbe "square" (x 2))
to get:
| 4 |
#+TBLFM: @1$1='(sbe "square" (x 2))

Thanks,
-I.S.

[-- Attachment #1.2: Type: text/html, Size: 670 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: How do you use call and lob in org-babel?
  2010-08-05 13:24 How do you use call and lob in org-babel? Inquisitive Scientist
@ 2010-08-05 17:02 ` Dan Davison
  2010-08-06  0:46   ` Eric Schulte
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Davison @ 2010-08-05 17:02 UTC (permalink / raw)
  To: Inquisitive Scientist; +Cc: emacs-orgmode

Hi I.S.,

Inquisitive Scientist <inquisitive.scientist@gmail.com> writes:

> Dear Experts,
>
> I am confused about how to use lob and call in org-babel. First I
> define a simple function like square:
> #+srcname: square(x)
> #+begin_src python
> return x*x
> #+end_src
>
> A line like
> : #+lob: square(x=2)
> does not seem to produce any result either in the buffer or on export:
> #+lob: square(x=2)
>
> The same seems to happen with call:
> : #+call: square(x=2)
> #+call: square(x=2)

I'm not seeing this. The following works for me with C-c C-c on the
lob/call lines. However, note that the #+call line will *appear* not to
do anything as things stand, because it sees the existing results block
created by the #+lob call.

#+srcname: square(x)
#+begin_src python
return x*x
#+end_src

#+lob: square(x=2)

#+results: square(x=2)
: 4

#+call: square(x=2)


Is the above definitely not working for you? What version of org are you
using?

Dan

>
> Instead, to get things to work I need to do something like:
> : | 4 |
> : #+TBLFM: @1$1='(sbe "square" (x 2))
> to get:
> | 4 |
> #+TBLFM: @1$1='(sbe "square" (x 2))
>
> Thanks,
> -I.S.
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Re: How do you use call and lob in org-babel?
  2010-08-05 17:02 ` Dan Davison
@ 2010-08-06  0:46   ` Eric Schulte
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Schulte @ 2010-08-06  0:46 UTC (permalink / raw)
  To: Dan Davison; +Cc: emacs-orgmode, Inquisitive Scientist

Dan Davison <davison@stats.ox.ac.uk> writes:

> Hi I.S.,
>
> Inquisitive Scientist <inquisitive.scientist@gmail.com> writes:
>
>> Dear Experts,
>>
>> I am confused about how to use lob and call in org-babel. First I
>> define a simple function like square:
>> #+srcname: square(x)
>> #+begin_src python
>> return x*x
>> #+end_src
>>
>> A line like
>> : #+lob: square(x=2)
>> does not seem to produce any result either in the buffer or on export:
>> #+lob: square(x=2)
>>
>> The same seems to happen with call:
>> : #+call: square(x=2)
>> #+call: square(x=2)
>
> I'm not seeing this. The following works for me with C-c C-c on the
> lob/call lines. However, note that the #+call line will *appear* not to
> do anything as things stand, because it sees the existing results block
> created by the #+lob call.
>
> #+srcname: square(x)
> #+begin_src python
> return x*x
> #+end_src
>
> #+lob: square(x=2)
>
> #+results: square(x=2)
> : 4
>
> #+call: square(x=2)
>

An equivalent example with slightly more visible output

--8<---------------cut here---------------start------------->8---
#+source: time
#+begin_src emacs-lisp
  (current-time-string)
#+end_src

#+call: time()

#+results: time()
: Thu Aug  5 20:45:34 2010
--8<---------------cut here---------------end--------------->8---

Note, currently the parenthesis after "time" are required, which perhaps
shouldn't be the case -- Eric

>
>
> Is the above definitely not working for you? What version of org are you
> using?
>
> Dan
>
>>
>> Instead, to get things to work I need to do something like:
>> : | 4 |
>> : #+TBLFM: @1$1='(sbe "square" (x 2))
>> to get:
>> | 4 |
>> #+TBLFM: @1$1='(sbe "square" (x 2))
>>
>> Thanks,
>> -I.S.
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2010-08-06  0:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-05 13:24 How do you use call and lob in org-babel? Inquisitive Scientist
2010-08-05 17:02 ` Dan Davison
2010-08-06  0:46   ` Eric Schulte

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).