Examples of lisp calling maxima



[Ed Symanzik , Thu, 15 Dec 2005 12:04:04 -0500]:
> http://en.wikipedia.org/wiki/Maxima says "the underlying Lisp can be
> called from Maxima."  Would someone please point me to documentation, a
> tutorial, or example of this?

You can call a Lisp function, or use Lisp variables, by prefixing
their names with ?, and you can get to the Lisp REPL with to_lisp(),
and you can evaluate an expression written in Lisp syntax by prefixing
it :lisp.  Example:

    (%i1) ?symbol\-name(foo);
    
    (%o1)                                $foo
    (%i2) ?print(a+b);
    
    
    ((MPLUS SIMP) |$a| |$b|) 
    (%o2)                                b + a
    (%i3) to_lisp();
    
    Type (to-maxima) to restart
    
    MAXIMA> #$a+b$
    ((MPLUS SIMP) |$a| |$b|)
    MAXIMA> (to-maxima)
    Returning to Maxima
    (%o3)                                TRUE
    (%i4) :lisp (symbol-name 'foo)
    
    FOO
    (%i4) 

HTH,

Albert.