Re: fork in Lisp? was: Maxima servermode: stability of commands....
Subject: Re: fork in Lisp? was: Maxima servermode: stability of commands....
From: Gerd Kortemeyer
Date: Wed, 10 May 2006 20:26:48 -0400
Hi Robert,
On May 10, 2006, at 5:52 PM, Robert Dodier wrote:
>
>> The server mode should also provide a more predictable command/answer
>> sequence and leave out the line counters (%oN) and prompts ($iN), as
>> well as all the whitespace.
>
> Not sure what you mean here. Maybe you can post a more detailed
> message about this.
As an example:
[www at phy1 www]$ maxima
Maxima 5.9.2.99rc1 http://maxima.sourceforge.net
Using Lisp SBCL 0.9.10
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) 42;
(%o1) 42
(%i2) x^2+2x^2;
Incorrect syntax: x is not an infix operator
(%i2) (%o2) 2
(%i3) 17;
(%o3) 17
(%i4) x^2+2*x^2;
2
(%o4) 3 x
(%i5) quit();
[www at phy1 www]$
On the screen in an interactive session, this is all just fine and
looks nice. But in server mode:
* we don't need a welcome message
* the (%i1) etc should not be produced
* the (%o1) etc should not be produced
* the syntax error should not mess up the sequence, i.e., the line
starting with (%i2) (%o2) should not be produced
* the pretty print should be disabled
* Errors should start with something that clients can easily
identify, e.g., "ERROR:"
So in server mode, the same sequence would look like this (without
the "Input:", "Output:" and quotation marks):
Input: "42;"
Output: "42"
Input: "x^2+2x^2;"
Output: "ERROR: Incorrect syntax: x is not an infix operator"
Input: "17;"
Output: "17"
Input: "x^2+2*x^2;"
Output: "3*x^2"
I guess what I am trying to say is that since it's not a human at the
other end, the communication needs to be terse and very predictable:
one input command produces one line of output.
- Gerd.