Hello,
On Mon, Mar 9, 2009 at 6:23 AM, R Fateman <fateman at cs.berkeley.edu> wrote:
> Perhaps a project would be a proper python to maxima linkage, not
> "pexpect" which William Stein of Sage claims is too slow, and therefore
> Maxima should be rewritten, piecemeal in python.
> ...
> I know nothing about pexpect.
It's just a Python module which spawns an application and 'talks' to
it over a pseudo-tty interface. It's slow in the sense that there is
a bit of overhead to use it.
> If a proper linkage were possible, e.g. taking a lisp data structure and
> returning it to python or vice versa, instead of whatever is done, would
> that fix
> everything?
Here is what I think is a feasible plan.
1) Run Maxima on top of ECL
2) Embed ECL into Python via a Cython module
3) Duplicate the API of the Maxima pexpect interface which basically
boils down to the following (where maxima is our object that
implements this API):
- Have maxima(obj) return a "pointer" to a symbol within the Maxima
session which corresponds to obj
- Have maxima.eval(string) evaluate string as if it were typed at
the Maxima prompt
- Have maxima.foo(a, b) call return a "pointer" to foo(a,b) in the
Maxima session
There are lots of little things like handling error, asksign, etc.
that would have to be dealt with on the Lisp side of things. It seems
like the Python/Cython/ECL embedding should be relatively
straightforward, but I then again, I have not actually done it.
--Mike