Re: How to embed Maxima in Common Lisp?
- From: Yigal <yigalasnis@xxxxxxxxx>
- Date: Mon, 20 Aug 2007 13:40:44 -0700
Thank you Robert for the detailed answer.
Finally I succeed to follow your instructions.
On my box Maxima was installed as debian package so it worked with GCL
only. When it came to this row:
:lisp (ext:saveinitmem "/tmp/foo-maxima.mem" :init-function 'cl-user::run),GCL said "no such package "ext"".
I installed Maxima from source with clisp and now it worked as you
wrote.
Apropos web server, I tested "lisp-cgi-utils" and mod_lisp for Apache,
it's work.
Thanks again,
Yigal
On Aug 19, 8:40 pm, Robert Dodier <robert.dod...@xxxxxxxxx> wrote:
Yigal, I think a useful approach here is to create a Lisp
binary image which contains your function or functions to
run the web stuff plus all of Maxima. That is easy to do:
launch Maxima, load your Lisp and/or Maxima functions,
and save the current Lisp state. Then you can launch Clisp
and tell it to run the saved image. This method works
with other Lisp implementations as well.
e.g. Here is my replacement for CL-USER::RUN. You will want
to write a function to read and write a socket, I guess.
$ cat /tmp/foo-run.lisp
(defun cl-user::run ()
(in-package :maxima)
(format t "HELLO FROM REPLACEMENT CL-USER::RUN~%")
(let (($display2d nil))
(displa (mfuncall '$foo 123 '$abc)))
(bye))
Here is a Maxima function called from CL-USER::RUN.
$ cat /tmp/foo-function.mac
foo (x, y) := (x - y)^(y - x);
Now I'll create the saved image. I'm running an already-built
Maxima here; it is not necessary to rebuild Maxima to
incorporate your new functions. I'll tell Clisp to call my
replacement CL-USER::RUN.
$ maxima -q -l clisp
load ("/tmp/foo-function.mac");
load ("/tmp/foo-run.lisp");
:lisp (ext:saveinitmem "/tmp/foo-maxima.mem" :init-function 'cl-
user::run)
quit ();
Now I'll run Clisp with the saved image.
$ clisp -q -M /tmp/foo-maxima.mem
HELLO FROM REPLACEMENT CL-USER::RUN
(123-abc)^(abc-123)
By the way, if you are working with web servers or whatever,
there are Lisp libraries for that. But first you need to get
comfortable with Lisp + Maxima. Hope this helps, & good luck.
Robert Dodier
.
- References:
- How to embed Maxima in Common Lisp?
- From: Yigal
- Re: How to embed Maxima in Common Lisp?
- From: Robert Dodier
- How to embed Maxima in Common Lisp?
- Prev by Date: Re: Sorting by enumeration
- Next by Date: Re: Sorting by enumeration
- Previous by thread: Re: How to embed Maxima in Common Lisp?
- Next by thread: type confusion
- Index(es):
Relevant Pages
|