From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: Maxima persistence between code blocks Date: Thu, 28 Apr 2011 11:56:39 +0100 Message-ID: <874o5ifxug.fsf@ucl.ac.uk> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:51017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFOtv-0004kx-8f for emacs-orgmode@gnu.org; Thu, 28 Apr 2011 06:56:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QFOtt-0000UM-Mj for emacs-orgmode@gnu.org; Thu, 28 Apr 2011 06:56:51 -0400 Received: from vscane-b.ucl.ac.uk ([144.82.108.141]:47379) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFOtt-0000Tz-Ik for emacs-orgmode@gnu.org; Thu, 28 Apr 2011 06:56:49 -0400 In-Reply-To: (Derek Thomas's message of "Wed, 27 Apr 2011 13:08:37 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Derek Thomas Cc: emacs-orgmode@gnu.org Derek Thomas 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 <> solution: solve([m = 2*day], [m]),numer$ print(solution); #+end_src #+results: unitstest : [m = 172800 s] --8<---------------cut here---------------end--------------->8--- Note the =<>= 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)