I think this design depends on whjch program is deemed to be in charge.
For example, for me, Lisp would be in charge. For you, python. Each has
advantages.
If I want to connect lisp to a program in python, java, visual basic, C,
Fortran etc, then
I can use the foreign function interface and call it. (Sometimes a thin
interface is necessary
to convert data to some kind of normal form.) This includes, as specific
examples, GMP and MPFR and NTL, MINPACK as well as web interfaces, and most
recently for me, speech interfaces using OLE, COM, or C# on windows.
I have run Lisp as a multi-processing supervisor which can manage
multiple web
connections.
Other people have translated FORTRAN (e.g. LINPACK) into Lisp, or PROLOG
into Lisp, or Java or python or .....
but it often makes sense to use their native compilers... e.g. I'd
rather call FORTRAN to take advantage of good FORTRAN compilers.
Not all versions of Lisp on which Maxima runs may do this, but some do
support
foreign function calls.
I assume it is possible to set up a way of calling Sage from Lisp
(including, presumably,
a Lisp that has Maxima loaded). But that would be the exact opposite of
what you would
do :)
RJF
Mike Hansen wrote:
> 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.
>
ok, like expect / but python.
>
>> 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
>