I tried for the last 2 days and this message is possibly a declaration
of stupidity, but the fact is that I could not do the job as I wanted.
In the end of this message I send an extract of a clisp session to
load MockMMA and a extract of one of the files I want to
translate.
>>>>> "Richard" == Richard Fateman <fateman@cs.berkeley.edu> writes:
Richard> 1. Change all Mathematica forms to FullForm. This can be
Richard> done easily in Mathematica. Thus x+y becomes Plus[x,y]
Richard> etc.
Richard> 2. Print out all such forms in a lisp-like form. Thus
Richard> Plus[x,y] is printed as (Plus x y).
Sorry, but how can I do this "easily" using Mathematica? I need to add
\\FullForm at the end of every line? I could not see a way of
translating all the file to FullForm.
Richard> 3. Read the resulting file into lisp.
Richard> Using an appropriate function like subst change Plus to
Richard> (mplus) Times to (mtimes) etc.
Do you have a list of these changes? With this list, I can provide a
Perl script to do this job.
Richard> If you actually don't have a Mathematica system, steps 1
Richard> and 2 can be done entirely in lisp by using my MockMMA
Richard> parser (written in Lisp), at least for Mathematica 2.0
Richard> syntax.
BTW I tried to load the mma1.6 in clisp without success. I followed
the instruction at davorpatch which accompanies mma1.6.tar.gz
*******************CLISP session Begin *************************
[1]> (load "init2")
;; Loading file /home/daniel/Mathematica/mma1.6/init2.fas ...
;; Loading of file /home/daniel/Mathematica/mma1.6/init2.fas is finished.
T
[2]> (tl)
*** - EVAL: the function TL is undefined
1. Break [3]>
*******************CLISP session End *************************
At last, here is an extract of one of the files I want to
translate. All files have the same pattern but have different modules
and definitions (of course).
******************* Mathematica file Begin *************************
BeginPackage["MyPackage`"]
MyPackage::usage="Do what I want"
Begin["`Private`"]
(* lots of definitions *)
Edges[Graph[v_,f_,nr_,e_,stnodes_,endnodes_ ]]:= e
(* lots of modules *)
DeleteVertex[Graph[v_,f_,nr_,e_,stnodes_,endnodes_ ],nodenr_Integer]:=
Module[{nodes = v,flags=f,numbers=nr,edges=e,
startnodes=stnodes,tailnodes=endnodes,i,tmpedge,tmpg},
edge = nodes[[nodenr]];
While[edge!=0,tmpedge= edge;
edge=edges[[edge]];
edges[[tmpedge]]=-1;
{startnodes[[tmpedge]],tailnodes[[tmpedge]]}={-1,-1}
]; (* end while *)
{nodes[[nodenr]],flags[[nodenr]],numbers[[nodenr]]} = {-1,-1,-1};
tmpg = Graph[nodes,flags,numbers,edges,startnodes,tailnodes];
For[i=1,i<=Length[edges],i++,
If[tailnodes[[i]]==nodenr,
tmpg = DeleteEdge[tmpg,i]
] (* end if *)
]; (* end for *)
tmpg
] (* end module *)
End[ ]
EndPackage[ ]
******************* Mathematica file Begin *************************