[Top][All Lists]

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

[Orgmode] Re: [BABEL] Octave issues

From: Juan
Subject: [Orgmode] Re: [BABEL] Octave issues
Date: Sun, 1 Aug 2010 19:55:56 -0300
User-agent: Mutt/1.5.20 (2009-06-14)

On Sun, Aug 01, 2010 at 06:19:30PM -0400, Dan Davison wrote:
> Juan <address@hidden> writes:

> Thanks very much. I've applied your patch with one minor change:
> (format "%s" (or var "nil"))
> However, is there a better way to receive an elisp nil value in octave?

[] can be used for an empty matrix.

What is the use-case for nil here?

> > I'm not working with sessions, so I have not yet tested the original
> > problem reported with 'org_babel_eoe' showing up as result.
> Sorry to pursue you for more help, but that problem is not limited to
> sessions. A very simple demonstration of it is

Apparently 'ans' won't help much; it only contains results of
operations, not assignments.

: The `ans' variable always contains the result of the last computation,
: where the output wasn't assigned to any variable. The code `a = cos
: (pi)' will assign the value -1 to the variable `a', but will not
: change the value of `ans'. However, the code `cos (pi)' will set the
: value of `ans' to -1.

I cannot find an alternative way of getting the result from the last

You can assign to 'ans' however, so it could be an inconvenient
requirement to either end the source block with a computation or with
an assignment to 'ans'. Yuk!

x = 42
ans = x

Another option, equally inconvenient, is to add a header option with
the name of the variable to return (in case it is not 'ans'):

#+begin_src :outvar x
x = 42
3 * 3  # this doesn't matter

Another much more fragile option would be to actually parse the end of
the code block looking for computation vs. assignment. This one will
never work!


reply via email to

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