[slime-devel] Maxima+Slime?

Has anybody here tried working with Maxima in Slime? I have managed to figure out how to load it (start slime with sbcl, load maxima-build.lisp, then do (maxima-load) to load the fasl files) and typing (run) will start Maxima OK, but then when I tried to do load("./file.mac"); I got some kind of error (don't have exact error on this machine, but can be provided.) Has anybody tried working with Maxima inside SLIME? I am definitely interested in this based on limited experience working without it, but I don't know how much of an ordeal it might be. Any help or experience appreciated, and thanks much for SLIME. CY __________________________________ Yahoo! Mail Stay connected, organized, and protected. Take the tour: http://tour.mail.yahoo.com/mailtour.html

C Y <smustudent1@yahoo.com> writes:
Has anybody here tried working with Maxima in Slime? I have managed to figure out how to load it (start slime with sbcl, load maxima-build.lisp, then do (maxima-load) to load the fasl files) and typing (run) will start Maxima OK, but then when I tried to do load("./file.mac"); I got some kind of error (don't have exact error on this machine, but can be provided.)
that would be very helpfull.
Has anybody tried working with Maxima inside SLIME? I am definitely interested in this based on limited experience working without it, but I don't know how much of an ordeal it might be.
afaik maxim runs inside its own repl, this could interfer with slime. -- -Marco Ring the bells that still can ring. Forget the perfect offering. There is a crack in everything. That's how the light gets in. -Leonard Cohen

--- Marco Baringer <mb@bese.it> wrote:
C Y <smustudent1@yahoo.com> writes:
Has anybody here tried working with Maxima in Slime? I have managed to figure out how to load it (start slime with sbcl, load maxima-build.lisp, then do (maxima-load) to load the fasl files) and typing (run) will start Maxima OK, but then when I tried to do load("./file.mac"); I got some kind of error (don't have exact error on this machine, but can be provided.)
that would be very helpfull.
OK, here we go: CL-USER> (run) Maxima 5.9.1.1cvs http://maxima.sourceforge.net Using Lisp SBCL 0.9.1 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. This is a development version of Maxima. The function bug_report() provides bug reporting information. (%i1) load("./unit.mac"); Maxima encountered a Lisp error: The value #<SWANK-BACKEND::SLIME-INPUT-STREAM {9006619}> is not of type SB-KERNEL:ANSI-STREAM. Automatically continuing. To reenable the Lisp debugger set *debugger-hook* to nil. (%i2) a; Maxima encountered a Lisp error: The value #<SWANK-BACKEND::SLIME-INPUT-STREAM {9006619}> is not of type SB-KERNEL:ANSI-STREAM. Automatically continuing. To reenable the Lisp debugger set *debugger-hook* to nil. (%i3) Actual output should look like: Maxima 5.9.1.1cvs http://maxima.sourceforge.net Using Lisp SBCL 0.9.1 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. This is a development version of Maxima. The function bug_report() provides bug reporting information. (%i1) load("./unit.mac"); ******************************************************************* * Units version 0.50 * * Definitions based on the NIST Reference on * * Constants, Units, and Uncertainty * * Conversion factors from various sources including * * NIST and the GNU units package * ******************************************************************* Redefining necessary functions... STYLE-WARNING: redefining TOPLEVEL-MACSYMA-EVAL in DEFUN STYLE-WARNING: redefining MSETCHK in DEFUN STYLE-WARNING: redefining KILL1 in DEFUN STYLE-WARNING: redefining NFORMAT in DEFUN Initializing unit arrays... Done. (%o1) ./unit.mac (%i2) a; (%o2) a (%i3)
Has anybody tried working with Maxima inside SLIME? I am definitely interested in this based on limited experience working without it, but I don't know how much of an ordeal it might be.
afaik maxim runs inside its own repl, this could interfer with slime.
Hmm. So it might take coding up a special REPL? Cheers, CY __________________________________ Discover Yahoo! Find restaurants, movies, travel and more fun for the weekend. Check it out! http://discover.yahoo.com/weekend.html

C Y <smustudent1@yahoo.com> writes:
--- Marco Baringer <mb@bese.it> wrote:
C Y <smustudent1@yahoo.com> writes:
Has anybody here tried working with Maxima in Slime? I have managed to figure out how to load it (start slime with sbcl, load maxima-build.lisp, then do (maxima-load) to load the fasl files) and typing (run) will start Maxima OK, but then when I tried to do load("./file.mac"); I got some kind of error (don't have exact error on this machine, but can be provided.)
that would be very helpfull.
OK, here we go:
CL-USER> (run) Maxima 5.9.1.1cvs http://maxima.sourceforge.net Using Lisp SBCL 0.9.1 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. This is a development version of Maxima. The function bug_report() provides bug reporting information. (%i1) load("./unit.mac");
Maxima encountered a Lisp error:
The value #<SWANK-BACKEND::SLIME-INPUT-STREAM {9006619}> is not of type SB-KERNEL:ANSI-STREAM.
so maxima implements its own repl which doesn't play nice with slime. all things considered that's to be expected. you could try starting lisp, then creating a swank server with (swank:create-swank-server), then restoring the streams with (revert-global-io-redirection), then starting maxima, then connecting to the running lisp via M-x slime-connect. this may (or may not) work. the only thing which is sure to work is to teach maxima to not rely ansi-streams (which probably isn't a good thing to be doing anyway). -- -Marco Ring the bells that still can ring. Forget the perfect offering. There is a crack in everything. That's how the light gets in. -Leonard Cohen

"Marco Baringer" <mb@bese.it> writes:
so maxima implements its own repl which doesn't play nice with slime. all things considered that's to be expected. you could try starting lisp, then creating a swank server with (swank:create-swank-server), then restoring the streams with (revert-global-io-redirection), then starting maxima, then connecting to the running lisp via M-x slime-connect. this may (or may not) work.
ps - i'd suggest starting maxima and the slime server from a terminal and not within emacs. pps - this is all assuming your lisp is multithreaded. things become more complicated on a single thread lisp. [basically: start lisp, create swank server, connect to swank server, make sure *debugger-hook* is #'swank:debugger-hook, start maxima, wait for maxima to drop you into a debugger and work from there]. this isn't nearly as nice as having a full fleged repl, but might be enough.

--- Marco Baringer <mb@bese.it> wrote:
so maxima implements its own repl which doesn't play nice with slime. all things considered that's to be expected. you could try starting lisp, then creating a swank server with (swank:create-swank-server), then restoring the streams with (revert-global-io-redirection), then starting maxima, then connecting to the running lisp via M-x slime-connect. this may (or may not) work.
(revert-global-io-redirection) is undefined when I try to run it.
ps - i'd suggest starting maxima and the slime server from a terminal and not within emacs.
pps - this is all assuming your lisp is multithreaded. things become more complicated on a single thread lisp. [basically: start lisp, create swank server, connect to swank server, make sure *debugger-hook* is #'swank:debugger-hook, start maxima, wait for maxima to drop you into a debugger and work from there]. this isn't nearly as nice as having a full fleged repl, but might be enough.
Is there a setting I need to tweak to make sure cmucl/sbcl are in multithreaded mode? Cheers, CY __________________________________ Discover Yahoo! Find restaurants, movies, travel and more fun for the weekend. Check it out! http://discover.yahoo.com/weekend.html

C Y <smustudent1@yahoo.com> writes:
Maxima encountered a Lisp error:
The value #<SWANK-BACKEND::SLIME-INPUT-STREAM {9006619}> is not of type SB-KERNEL:ANSI-STREAM.
This particular bit looks like a SBCL bug. interactive-stream-p doesn't work on Gray streams.
Hmm. So it might take coding up a special REPL?
Depends on what you want. Maxima's REPL should also work in SLIME. Of course this will (should) only be the same as in a terminal. If you need fancy stuff like Maxima specific completion or indentation you have to create your own REPL. (Probably quite a bit of work.) Perhaps there's a cheaper solution, e.g. you could try to use the normal SLIME REPL and a reader macro that reads the rest of the line as Maxima syntax. Don't know how useful/feasible that is. Helmut.

--- Helmut Eller <heller@common-lisp.net> wrote:
C Y <smustudent1@yahoo.com> writes:
Maxima encountered a Lisp error:
The value #<SWANK-BACKEND::SLIME-INPUT-STREAM {9006619}> is not of type SB-KERNEL:ANSI-STREAM.
This particular bit looks like a SBCL bug. interactive-stream-p doesn't work on Gray streams.
In CMUCL, the failure looks like this: (%i1) a; Maxima encountered a Lisp error: :INTERACTIVE-P fell through ECASE expression. Wanted one of (:CLOSE :ELEMENT-TYPE :GET-COMMAND :LINE-LENGTH :CHARPOS :LISTEN :CLEAR-INPUT :UNREAD :FILE-LENGTH :FILE-POSITION). Automatically continuing. To reenable the Lisp debugger set *debugger-hook* to nil.
Hmm. So it might take coding up a special REPL?
Depends on what you want. Maxima's REPL should also work in SLIME. Of course this will (should) only be the same as in a terminal. If you need fancy stuff like Maxima specific completion or indentation you have to create your own REPL. (Probably quite a bit of work.)
That I don't think we have anyway (would be nice though.) Terminal would be fine, but it doesn't seem to like something somewhere here :-/.
Perhaps there's a cheaper solution, e.g. you could try to use the normal SLIME REPL and a reader macro that reads the rest of the line as Maxima syntax. Don't know how useful/feasible that is.
Before that point I'll probably stick with the multithread solution, which does seem to work OK :-). Won't help on anything but cmucl or (maybe) sbcl, but I'm content to work with those for a while. Cheers, CY __________________________________ Discover Yahoo! Have fun online with music videos, cool games, IM and more. Check it out! http://discover.yahoo.com/online.html

Helmut Eller <heller@common-lisp.net> writes:
C Y <smustudent1@yahoo.com> writes:
Maxima encountered a Lisp error:
The value #<SWANK-BACKEND::SLIME-INPUT-STREAM {9006619}> is not of type SB-KERNEL:ANSI-STREAM.
This particular bit looks like a SBCL bug. interactive-stream-p doesn't work on Gray streams.
I just checked in a fix for this. (interactive-stream-p isn't mentioned in Gray's proposal, but it makes sense for it to be a generic function.) Rudi

C Y <smustudent1@yahoo.com> writes:
Has anybody here tried working with Maxima in Slime? I have managed to figure out how to load it (start slime with sbcl, load maxima-build.lisp, then do (maxima-load) to load the fasl files) and typing (run) will start Maxima OK,
It's perhaps simpler to use the existing maxima image. The example below uses a build tree, but it should be easy to adapt it to a regular installation (which I never do :-) C-u M-x slime and then type in the minibuffer sbcl --core /usr/src/maxima/src/binary-sbcl/maxima.core In order to get Maxima to set the various paths correctly I find it easiest to set MAXIMA_PREFIX and MAXIMA_LAYOUT_AUTOTOOLS in the environment. You can do this either from the shell before starting emacs or from within emacs before starting slime. The latter works like this (but your settings are likely different) (setenv "MAXIMA_PREFIX" "/usr/src/maxima/") (setenv "MAXIMA_LAYOUT_AUTOTOOLS" "false")
but then when I tried to do load("./file.mac"); I got some kind of error
I think you get the same error if you just type `true;' or something. Not a serious problem as far as Maxima is concerned. Just a spurious call to interactive-stream-p in OUTPUT (src/displa.lisp). Apparently, SBCL (and CMUCL) doesn't like being passed a Gray stream as argument here. In any case this call will be eliminated as part of http://www.math.utexas.edu/pipermail/maxima/2005/009681.html Wolfgang
participants (6)
-
Andras Simon
-
C Y
-
Helmut Eller
-
Marco Baringer
-
Rudi Schlatte
-
Wolfgang Jenkner