Replies: 2 comments
-
MockMMA was written and tested in Allegro Common Lisp, circa 1992. It seems to have been used some here and there; I see at least
If there are specific questions about MockMMA I'll try to answer them; I may try to run this code (23 years old?) in an SBCL, myself. |
Beta Was this translation helpful? Give feedback.
-
One additional comment -- the parser for the "Wolfram Language" (WL) which I wrote in Lisp, can be written easily in WL, which of course already knows how to parse WL. All that is needed is a program that prints it out in Lisp. Mathematica fans will probably be aware that there is a WL program called FullForm which prints A+B as Plus[A,B]. A program I wrote, called LForm for Lisp Form prints A+B as (Plus A B). That's Lisp. ToStringS[u_]:=ToString[u]<>" " (* convert u to a string, but add a space on the right *)
LForm[m_Rational] := ToString[Numerator[m]]<> "/"<> ToStringS[Denominator[m]] (* 3 special edge cases *)
LForm[m_Complex]:=LForm[Re[m]+"I"*Im[m]]
LForm[n_Real]:= LForm[ToString[FortranForm[n]]]
LForm[a_?AtomQ]:=ToStringS[a]
LForm[r_[args___]]:= StringJoin@@{"(",ToStringS[r] , LForm/@ {args},")"}
(* to read and write whole files of Rubi rules, converting them from WL to Lisp, we do this *)
(* we need inertify to keep SetDelayed from evaluating and then returning Null. courtesy Dan L *)
inertify[expr_Hold] := With[{i1 = inertify1[expr]}, i1 /. Hold -> Identity]
inertify1[expr_Hold] := Module[{xx},
xx[Release[expr /. (f_Symbol /; f =!= Hold && f =!= HoldAll) :> ToString[f]]] /. xx -> Hold]
(* How it works: we would iterate through all the files. example of one file *)
( infile =OpenRead["d:/rubi1222.m"] (*some rubi.m file*);
outfile= OpenWrite["d:/lisp/rubi1222.lisp"] (*that file in Lisp *);
(WriteString[outfile,LForm[inertify/@ ReadList[infile,Hold[Expression]]]];
Close[infile]; Close[outfile]) Sample input... first line of the .m file first line of the .lisp file [omitting a "(List" at the top of the file, and reformatting for indentation...]
|
Beta Was this translation helpful? Give feedback.
-
I was wondering if a subset of the Rubi rules that do not rely heavily on the internal details of PossibleZeroQ, N, Simplify, etc will run in LISP with MockMMA?
I could never get MockMMA to run in SBCL (although this was many years ago).
Beta Was this translation helpful? Give feedback.
All reactions