Maxima does some extensive setup so using it as a library is a bit problematic. I like your solution of saving a core which you can load up later. You will want to execute the function (MAXIMA::RUN) to get the Maxima REPL back (if you want it...).
My solution has been to set up a swank server inside Maxima. This is geared toward interactive work. Start up Maxima normally, then use this:
Code: Select all
:lisp (asdf:oos 'asdf:load-op :swank)
:lisp (swank:create-server :port 7777 :dont-close t)
Then, from Emacs, do a M-x slime-connect -- address is 127.0.0.1 -- port is 7777-- and you will get a Lisp REPL. Now, if you want to do some Maxima stuff, jump to your Maxima REPL and use it; if you want to do Lisp stuff, jump to the Slime REPL. This has the nice benefit of allowing you to use something like iMaxima to interact with Maxima interactively. But you can also use the full Slime setup to build a program that uses the Maxima facilities. And you can develop in CL and Maxima at the same time.
Some warnings about using Maxima for this purpose, however. First, I learned fairly quickly that it seems Maxima is not in any way thread safe. There will probably be some Maxima people who will disagree, I don't know. I do know that trying to call the same function in parallel yields weird results. Sometimes using seemingly unrelated Maxima stuff at the same time will cause problems. I would not trust calculations where more than one MEVAL or MFUNCALL is being used at a time. This is my experience from 6-10 months ago, things may be different now.
Second, Maxima is quite slow at number crunching. I was using Maxima to calculate matrices which I then used in an integration. I was integrating via Romberg. It would have been smarter to translate the matrix to a CL data type, then perform the calculations via GSL or something. What I mean is, use Maxima for things that can be slow but try to turn the Maxima output into CL where efficiency matters.