emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] babel, header arguments.


From: jenia.ivlev
Subject: Re: [O] babel, header arguments.
Date: Fri, 21 Nov 2014 14:35:40 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Sebastien Vauban <address@hidden>
writes:

> jenia.ivlev wrote:
>> So lets say there's this function:
>>
>>     #+name: my-plus
>>     #+begin_src scheme
>>         (define my-plus
>>           (lambda (x y) (+ x y)))
>>     #+end_src
>>
>> And i want to call it from another source block, like so:
>>
>>     #+tblname: addition
>>     | sum    |
>>     |--------|
>>     | #ERROR |
>>     #+TBLFM: @2$1='(org-sbe "my-plus" (33 22))
>>
>> As you can see, I get an error. How do I write these "header-arguments"
>> (i think they are called) to achieve calling one src-block from another.
>
> This should do it (untested):
>
> (org-sbe "my-plus" (x 33) (y 22))
>
>> Also, second scenario, can I somehow call my-plus from a source-block as
>> so:
>>
>>      #+begin_src scheme
>>          (my-plus 3 4)
>>      #+end_src
>
> I think you must also call `org-sbe'.
>
> Best regards,
>   Seb

Thanks a lot Seb. It worked perfectly for the table.
For the "second scenario" I don't understand how to import the results
of my-plus function. The only thing I can think of is something like 
this (it doesnt work by the way):

    #+begin_src scheme
        (+ z 1)
    #+end_src
    #+ z='(org-sbe "my-plus" (x 33) (y 22))

Also, what if I want to import the actual function defintion into another src
block:

    #+begin_src scheme
        (+ (my-plus 3 4) 1)
    #+end_src
    something here that import the previous function definitions

Is that possible?




    




reply via email to

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