emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [babel] inline call within table formula?
@ 2011-07-08 15:19 Eric S Fraga
  2011-07-10 15:54 ` Eric Schulte
  0 siblings, 1 reply; 7+ messages in thread
From: Eric S Fraga @ 2011-07-08 15:19 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Quick question: I'd like to use a babel inline call to calculate
something in a table based on other values in the table.  Is this
possible?  Probably using elisp directly?  If so, I cannot figure out
what the magic incantation should be!  I hope somebody can help.

For illustration, I'd like to do something like this:

--8<---------------cut here---------------start------------->8---
#+source: f
#+begin_src octave :var x=[1 3 5]
sin(x)
#+end_src

| x1 | x2 | x3 | f                        |
|----+----+----+--------------------------|
|  1 |  3 |  5 | Apply call_f($1..$3) here |
--8<---------------cut here---------------end--------------->8---

Thanks,
eric

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.6 (release_7.6.4.gf305a)

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

* Re: [babel] inline call within table formula?
  2011-07-08 15:19 [babel] inline call within table formula? Eric S Fraga
@ 2011-07-10 15:54 ` Eric Schulte
  2011-07-11  8:24   ` Eric S Fraga
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Schulte @ 2011-07-10 15:54 UTC (permalink / raw)
  To: emacs-orgmode

Hi Eric,

The `sbe' macro can be used to evaluate code blocks in table formula.

For Example:

|   1 |
|   2 |
|   3 |
|   4 |
|   5 |
|   6 |
| 3.5 |
#+TBLFM: @7$1='(sbe mean (lst @1..@6))

#+source: mean
#+begin_src emacs-lisp :var lst=()
  (let ((num (car lst)) (nums (cdr lst)))
    (/ (float (+ num (apply #'+ nums))) (1+ (length nums))))
#+end_src

See the documentation string of this macro for more information.

Best -- Eric

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> Hi,
>
> Quick question: I'd like to use a babel inline call to calculate
> something in a table based on other values in the table.  Is this
> possible?  Probably using elisp directly?  If so, I cannot figure out
> what the magic incantation should be!  I hope somebody can help.
>
> For illustration, I'd like to do something like this:
>
> #+source: f
> #+begin_src octave :var x=[1 3 5]
> sin(x)
> #+end_src
>
> | x1 | x2 | x3 | f                        |
> |----+----+----+--------------------------|
> |  1 |  3 |  5 | Apply call_f($1..$3) here |
>
> Thanks,
> eric

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

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

* Re: [babel] inline call within table formula?
  2011-07-10 15:54 ` Eric Schulte
@ 2011-07-11  8:24   ` Eric S Fraga
  2011-07-11  8:48     ` Sebastien Vauban
  0 siblings, 1 reply; 7+ messages in thread
From: Eric S Fraga @ 2011-07-11  8:24 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

Eric Schulte <schulte.eric@gmail.com> writes:

> Hi Eric,
>
> The `sbe' macro can be used to evaluate code blocks in table formula.

Argghhhh, yes, I now remember this coming up in the list a long time
ago.  Thanks for reminding me.

I wasn't able to find it using typical keywords unfortunately.  I also
wasn't able to find it in the info manual.  I'll look around some more.

Thanks again,
eric
-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.6 (release_7.6.35.g30182)

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

* Re: [babel] inline call within table formula?
  2011-07-11  8:24   ` Eric S Fraga
@ 2011-07-11  8:48     ` Sebastien Vauban
  2011-07-11  9:03       ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Sebastien Vauban @ 2011-07-11  8:48 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Eric,

Eric S Fraga wrote:
> Eric Schulte <schulte.eric-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>> The `sbe' macro can be used to evaluate code blocks in table formula.
>
> Argghhhh, yes, I now remember this coming up in the list a long time
> ago.  Thanks for reminding me.
>
> I wasn't able to find it using typical keywords unfortunately.  I also
> wasn't able to find it in the info manual.  I'll look around some more.

I confirm it's not easy to find. Did try for 5 mins without success.

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: [babel] inline call within table formula?
  2011-07-11  8:48     ` Sebastien Vauban
@ 2011-07-11  9:03       ` Bastien
  2011-07-11 10:01         ` Eric S Fraga
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2011-07-11  9:03 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: emacs-orgmode

Hi Sébastien,

"Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> writes:

> Eric S Fraga wrote:
>> Eric Schulte <schulte.eric@gmail.com> writes:
>>> The `sbe' macro can be used to evaluate code blocks in table formula.
>>
>> Argghhhh, yes, I now remember this coming up in the list a long time
>> ago.  Thanks for reminding me.
>>
>> I wasn't able to find it using typical keywords unfortunately.  I also
>> wasn't able to find it in the info manual.  I'll look around some more.
>
> I confirm it's not easy to find. Did try for 5 mins without success.

Patch welcome!

-- 
 Bastien

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

* Re: [babel] inline call within table formula?
  2011-07-11  9:03       ` Bastien
@ 2011-07-11 10:01         ` Eric S Fraga
  2011-07-11 15:23           ` Eric Schulte
  0 siblings, 1 reply; 7+ messages in thread
From: Eric S Fraga @ 2011-07-11 10:01 UTC (permalink / raw)
  To: Bastien; +Cc: Sebastien Vauban, emacs-orgmode

Bastien <bzg@altern.org> writes:

> Hi Sébastien,
>
> "Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> writes:
>
>> Eric S Fraga wrote:
>>> Eric Schulte <schulte.eric@gmail.com> writes:
>>>> The `sbe' macro can be used to evaluate code blocks in table formula.
>>>
>>> Argghhhh, yes, I now remember this coming up in the list a long time
>>> ago.  Thanks for reminding me.
>>>
>>> I wasn't able to find it using typical keywords unfortunately.  I also
>>> wasn't able to find it in the info manual.  I'll look around some more.
>>
>> I confirm it's not easy to find. Did try for 5 mins without success.
>
> Patch welcome!

On my TODO list! ;-)

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.6 (release_7.6.35.g30182)

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

* Re: [babel] inline call within table formula?
  2011-07-11 10:01         ` Eric S Fraga
@ 2011-07-11 15:23           ` Eric Schulte
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Schulte @ 2011-07-11 15:23 UTC (permalink / raw)
  To: Bastien; +Cc: Sebastien Vauban, emacs-orgmode

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> Bastien <bzg@altern.org> writes:
>
>> Hi Sébastien,
>>
>> "Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> writes:
>>
>>> Eric S Fraga wrote:
>>>> Eric Schulte <schulte.eric@gmail.com> writes:
>>>>> The `sbe' macro can be used to evaluate code blocks in table formula.
>>>>
>>>> Argghhhh, yes, I now remember this coming up in the list a long time
>>>> ago.  Thanks for reminding me.
>>>>
>>>> I wasn't able to find it using typical keywords unfortunately.  I also
>>>> wasn't able to find it in the info manual.  I'll look around some more.
>>>
>>> I confirm it's not easy to find. Did try for 5 mins without success.
>>
>> Patch welcome!
>
> On my TODO list! ;-)

Fantastic, this is sorely missing from the info manual, although I think
the function documentation should be useful.

Thanks -- Eric

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

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

end of thread, other threads:[~2011-07-11 15:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-08 15:19 [babel] inline call within table formula? Eric S Fraga
2011-07-10 15:54 ` Eric Schulte
2011-07-11  8:24   ` Eric S Fraga
2011-07-11  8:48     ` Sebastien Vauban
2011-07-11  9:03       ` Bastien
2011-07-11 10:01         ` Eric S Fraga
2011-07-11 15:23           ` 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).