emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Re: How do you use call and lob in org-babel?


From: Eric Schulte
Subject: Re: [Orgmode] Re: How do you use call and lob in org-babel?
Date: Thu, 05 Aug 2010 20:46:12 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Dan Davison <address@hidden> writes:

> Hi I.S.,
>
> Inquisitive Scientist <address@hidden> 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.
>> address@hidden
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode



reply via email to

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