Le samedi 30 juillet 2005 à 14:35 -0500, [EMAIL PROTECTED] a écrit : > Ok. Now I have a clue but it's subtle. > > You write this in your .axiom.input file: > > mrandom(x:Integer,v:Integer,z:Integer):ColumnMajorMatrix(SF) = > a:=matrix([[random(x)::SF for i in 1..y] for j in > 1..x])$ColumnMajorMatrix(SF) > a > > You can't see this function even though it appears to be defined. That's > because Axiom is working in a new frame.
Humm, I was thinking about that... > > When you start AXIOMsys you are running the interpreter talking directly > to the terminal. So the .input file is actually talking to a frame > at the top level. Your function is defined. > > The .axiom.input file is read in a "frame" called "initial". > AXIOMsys only uses the "initial" frame (although you can define and > use new ones). A frame contains its own variables and function definitions. > > The "axiom" command does several things that AXIOMsys does not. In > particular the axiom shell script starts up the 'sman' process which > starts AXIOMsys (which reads the .axiom.input file) and then sman > creates a new frame (usually a random lisp gensym name). In this new > frame (created after .axiom.input is read) your mrandom function is > not defined. > > To see this do: > AXIOMsys > mrandom(3,3,3) -- compiles and runs the function > )quit > > Now do: > axiom > mrandom(3,3,3) -- undefined function > )frame next > mrandom(3,3,3) -- compiles and runs the function > )frame names -- shows you all of the defined frames > )quit > > > So with the axiom shell script the process is: > axiom > start sman (done by axiom shell script) > sman starts AXIOMsys (done by sman) > create frame "initial" (done by AXIOMsys) > read .axiom.input (define your function here) > create frame "G00234" (done by sman) > put up a command prompt (in frame G00234, no functions defined) > )frame next (done by you) > .... and now you're back in frame initial > .... and your function is there > > > So your function was read and it is defined. However the function got > defined in the "initial" frame (because you defined it in the .axiom.input > file) and is not known in the frame created by sman. The ")frame next" > command will move you around the ring of frames. (See the hardcopy book > on page 579). > > Tim > > Thank you very much Cheers, Greg _______________________________________________ Axiom-developer mailing list Axiom-developer@nongnu.org http://lists.nongnu.org/mailman/listinfo/axiom-developer