emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric S Fraga <e.fraga@ucl.ac.uk>
To: Derek Thomas <derekcthomas@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Maxima persistence between code blocks
Date: Thu, 28 Apr 2011 11:56:39 +0100	[thread overview]
Message-ID: <874o5ifxug.fsf@ucl.ac.uk> (raw)
In-Reply-To: <BANLkTimyoxKEY5CfFDJeW_xQ3obJLGS=pw@mail.gmail.com> (Derek Thomas's message of "Wed, 27 Apr 2011 13:08:37 -0500")

Derek Thomas <derekcthomas@gmail.com> writes:

> I'm interested in using org-mode with babel to organize my maxima
> code.  Am I correct in my reading of ob-maxima.el that the babel
> module for maxima doesn't support persistent variables between code
> blocks?  

Correct, basically.

> If so, this seems like a severe limitation.

There are solutions (see below), but their suitability will depend on
*your* use case.  What specifically can you not do currently that you
would like to do (or do more easily)?

> I did some
> searching and found this guide
> (http://www.math.utexas.edu/pipermail/maxima/2010/021027.html) for
> setting up a local maxima "server".  
>
> I'm trying to implement an org
> interface to this process, but my elisp skills are extremely
> rudimentary.  If anyone has any suggestions or recommendations for
> code that does something similar, that would be great.  Thanks,

For org + babel, the more appropriate solution might be to add session
support for maxima.  In principle, this should be possible as one can
have a maxima inferior process; there is no need to re-invent the wheel
as described above basically.  However, I am not sure how to go about
doing this.  I'll investigate when I have some time (but am not
promising anything soon unfortunately) but maybe you could have a look.
Check out other babel languages that provide session support (R?).

In the meantime, there are two alternatives, which I use all the time,
which may help: code tangling =(info "(org) Extracting source code")=
and noweb =(info "(org) Noweb reference syntax")=.  I use the latter
frequently:

--8<---------------cut here---------------start------------->8---

#+srcname: units
#+begin_src maxima
h: 3600*s$
day: 24*h$
#+end_src

#+srcname: unitstest
#+begin_src maxima :results output :exports results :noweb yes
<<units>>
solution: solve([m = 2*day], [m]),numer$
print(solution);
#+end_src

#+results: unitstest
: [m = 172800 s] 

--8<---------------cut here---------------end--------------->8---

Note the =<<units>>= reference in the latter code block.

HTH,
eric

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.209.g1a687)

      reply	other threads:[~2011-04-28 10:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-27 18:08 Maxima persistence between code blocks Derek Thomas
2011-04-28 10:56 ` Eric S Fraga [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874o5ifxug.fsf@ucl.ac.uk \
    --to=e.fraga@ucl.ac.uk \
    --cc=derekcthomas@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).