[armedbear-devel] Fwd: How to compile and run Maxima with ABCL?

Phuc Luoi phucluoi at gmail.com
Tue Jun 19 11:29:58 UTC 2012


---------- Forwarded message ----------
From: Phuc Luoi <phucluoi at gmail.com>
Date: Tue, Jun 19, 2012 at 12:51 PM
Subject: Re: [armedbear-devel] How to compile and run Maxima with ABCL?
To: Robert Dodier <robert.dodier at gmail.com>


Thanks for your answer.

I tried this and got these errors:

Can't intern zero-length symbol.
Restarts:
 0: RETRY     Retry compiling #<ASDF:CL-SOURCE-FILE "maxima"
"utilities" "mformt">.
 1: ACCEPT    Continue, treating compiling #<ASDF:CL-SOURCE-FILE
"maxima" "utilities" "mformt"> as having been successful.
 2: TOP-LEVEL Return to top level.

by compiling the file
/maxima-5.27.0/src/mformt.lisp (step 9)

I have choose the option 1 to accept this. I got some more errors by
compiling. After all I got

Out of memory PermGen space
Restarts:
 0: TOP-LEVEL Return to top level.

and abcl did not compiled maxima.

Can you tell me why I got these error? And how can repair them?



On Tue, Jun 19, 2012 at 5:04 AM, Robert Dodier <robert.dodier at gmail.com> wrote:
> On 2012-06-16, Phuc Luoi <phucluoi at gmail.com> wrote:
>
>> How can I compile and run Maxima with ABCL?
>
> (1) Unpack a Maxima tarball.
> http://sourceforge.net/projects/maxima and follow links to download page.
> Look for "Maxima-source".
>
> (2) cd /path/to/maxima-5.27.0
>
> (3) java -jar /path/to/abcl.jar
>
> (4) (configure) ;; you can probably accept defaults for most/all questions
>
> (5) (quit)
>
> (6) cd src
>
> (7) java -jar /path/to/abcl.jar
>
> (8) (require 'asdf)
>
> (9) (asdf:operate 'asdf:load-op :maxima)
>
> (10) (quit)
>
> (11) java -jar /path/to/abcl.jar
>
> (12) (require 'asdf)
>
> (13) (asdf:operate 'asdf:load-op :maxima) ;; yes, same as (9)
>
> (14) (cl-user::run) ;; should bring up Maxima banner & input prompt
>
>
>> Furthermore can I emmbed maxima in a Java Programm with ABCL?
>
> Yes. I've appended an example program. Command line to compile it:
>
>  javac -cp /path/to/abcl.jar -d /path/to/compiled/class abcl_maxima.java
>
> To execute it: (you must be in the Maxima src directory)
>
>  java -cp /path/to/compiled/class:/path/to/abcl.jar abcl_maxima
>
> I get: (takes a minute or two to load Maxima)
>
> loading Maxima ... finished.
> x.getClass => class org.armedbear.lisp.Cons
> x = org.armedbear.lisp.Cons at 1748ba8
> x.javaInstance => org.armedbear.lisp.Cons at 1748ba8
> x.javaInstance.getClass => class org.armedbear.lisp.Cons
> 4 factors of 12341234
> factor: 2, multiplicity: 1
> factor: 73, multiplicity: 1
> factor: 137, multiplicity: 1
> factor: 617, multiplicity: 1
>
>
> Note that all user functions have names which begin with dollar sign.
> E.g. user function ifactors <==> $IFACTORS in Lisp
>
> If you need help with Lisp programming for Maxima, ask questions on the
> mailing list. See: http://maxima.sourceforge.net/maximalist.html
>
> Hope this helps, have fun, & good luck.
>
> Robert Dodier
>
> PS. Example program abcl_maxima.java:
>
> // abcl_maxima.java -- example program for calling Maxima from Java via ABCL
> // copyright 2012 by Robert Dodier
> // I release this work under terms of the GNU General Public License
>
> import org.armedbear.lisp.Interpreter;
> import org.armedbear.lisp.Package;
> import org.armedbear.lisp.Packages;
> import org.armedbear.lisp.Symbol;
> import org.armedbear.lisp.Function;
> import org.armedbear.lisp.LispObject;
> import org.armedbear.lisp.Fixnum;
> import org.armedbear.lisp.Bignum;
> import org.armedbear.lisp.Cons;
>
> public class abcl_maxima
> {
>        public static void main (String [] args) throws Exception
>        {
>                int a;
>
>                if (args.length > 0)
>                        a = Integer.parseInt (args [0]);
>                else
>                        a = 12341234;
>
>                Interpreter I = Interpreter.createInstance ();
>                System.out.print ("loading Maxima ... ");
>                I.eval ("(require 'asdf)");
>                I.eval ("(asdf:operate 'asdf:load-op :maxima)");
>                System.out.println ("finished.");
>                Package P = Packages.findPackage ("MAXIMA");
>
>        //      java.util.List <Symbol> L = P.getAccessibleSymbols ();
>        //      for (Symbol S : L)
>        //      {
>        //              if (P.equals (S.getPackage ()))
>        //                      System.out.println (S.toString ());
>        //      }
>
>                Symbol S = P.findAccessibleSymbol ("$IFACTORS");
>                Function F = (Function) S.getSymbolFunction ();
>                LispObject x = Bignum.getInstance (a);
>                x = F.execute (x);
>                System.out.println ("x.getClass => " + x.getClass ());
>                System.out.println ("x = " + x);
>                System.out.println ("x.javaInstance => " + x.javaInstance ());
>                System.out.println ("x.javaInstance.getClass => " + x.javaInstance () . getClass ());
>
>                int n = ((Cons) x).length ();
>                System.out.println ((n - 1) + " factors of " + a);
>
>                for (int i = 1; i < n; i++)
>                {
>                        Cons x1 = (Cons) ((Cons) x).NTH (i);
>                        Fixnum f = (Fixnum) x1.NTH (1);
>                        Fixnum m = (Fixnum) x1.NTH (2);
>                        System.out.println ("factor: " + f.intValue () + ", multiplicity: " + m.intValue ());
>                }
>        }
> }
>
>
> _______________________________________________
> armedbear-devel mailing list
> armedbear-devel at common-lisp.net
> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel




More information about the armedbear-devel mailing list