Using Maxima from Racket



Jens Axel S?gaard wrote:
> Hi Robert,
>
> 2012/3/9 Robert Dodier <robert.dodier at gmail.com>
>
>> On 3/8/12, Jens Axel S?gaard <jensaxel at soegaard.net> wrote:
>>
>> > using Lisp SBCL 1.0.47
>>
>> > Maxima has an option -s <port> that makes Maxima listen on a give port.
>>
>> Well, maxima -s makes Maxima the client, not the server.
>>
>
> Yes. In my snippet I use the Racket construct tcp-accept to setup a
> listener,
> and I did get the welcome message from Maxima.
>
>
>> For a simple-minded Unixish server, try share/contrib/maxima-server.lisp.
>> It only works with SBCL, but you're in luck!
>> See the comment header of maxima-server.lisp for some info.
>>
>
> I'll take a look.
>
>
>> Also there are command-line options to suppress output cruft.
>> Try maxima --help and look for --quiet and --very-quiet.
>>
>
> Ooh! Thanks for pointing to --very-quiet. I missed them in the
> documentation.
>
>
>> As to the output format, after display2d:false, output is rendered in
>> the so-called 1-d format, which might be easier to parse automatically.
>> You can probably convince Maxima to return only S-expressions by
>>
>> :lisp (print #$<input expression goes here>$)
>>
>
> Great! This will be particular easy to parse in Scheme.
>
> I just tried maxima-server w/ --very-quiet and it looks like Maxima
>> fails to flush its output buffer. If you want to try that I can look into
>> it.
>>
>
> Since my original email, I have actually written a working repl.
>
> Something is puzzling me though. Using the -s option with Maxima on SBCL on
> OS X, I can receive the output from Maxima via the socket on the given port.
> Sending to Maxima via the socket doesn't work though. I have to send the
> commands via the input port of the Maxima process.
>
> Is this the intended way of sending commands to Maxima when using the -s
> flag?
>
> Maybe the cause of this is SBCL? The same (I think) problem is described
> here:
> http://osdir.com/ml/mathematics.maxima.general/2004-03/msg00020.html
>

Try to use the technique in
http://www.math.utexas.edu/pipermail/maxima/2012/027820.html

-- 
Michel Talon