> <\body> interpreter> The interpreter starts with the command: <\session|shell|default> <\unfolded-io|Shell] > mmx-light <|unfolded-io> -------------------------------------------------------------- \|:*) \ \ \ \ \ \ \ \ \ Welcome to Mathemagix-light 0.4 \ \ \ \ \ \ \ \ \ \ \ \ (*:\| \|------------------------------------------------------------\| \| \ This software falls under the GNU General Public License \ \| \| \ \ \ \ \ \ \ \ \ It comes without any warranty whatsoever \ \ \ \ \ \ \ \ \ \| \| \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ www.mathemagix.org \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \| \| \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (c) 2001--2010 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \| -------------------------------------------------------------- If you use the interpreter in a textual context, several shortcuts can be very useful such as: <\itemize> , to go to the beginning or end of the instruction line, >, > for the previous and next instruction lines, for name completion, to add an extra line to the current instruction line when using a text terminal. Note that on several platforms the key is binded to . On the terminal, unless the key has been specifically set so from the terminal preferences menu, one must type and then . Within a session, one has to type . Different modes are available: <\itemize-dot> to print the type information with the result of an evaluation in the interpreter.\ to print the time needed to evaluate an instruction line when it is bigger than 1 ms.\ to print debug information when an error occurs;\ to print only the input command and opt result of an evaluation (no prompt, no banner);\ files> A classical way to develop code is to edit files and load them from the interpreter. As an example, we give below the content of a file (in ): <\mmx-code> f (n: Int): Int == {\ \ \ if n \ 2 then return n;\ \ \ else { \ \ \ \ mmout \\ n \\ "\\n"; \ \ \ \ if n mod 2 = 0 then return f (n quo 2); \ \ \ \ else return f (3*n + 1); \ \ } } It can be used from the interpreter as follows: <\session|mathemagix|default> <\input> <|input> include "mmxlight/step1.mmx" <\unfolded-io> <|unfolded-io> f 5 <|unfolded-io> files as scripts> The interpreter can be used directly with a file: <\shell-code> mmx-light step1.mmx files can also be used as , as shown in this example: <\mmx-code> #!/usr/bin/env mmx-light m: Double := 0.0; for i in 1..#argv do \ \ m := m + as_double argv[i]; mmout \\ "Mean: " \\ m / (#argv-1) \\ "\\n"; If this code is saved into a file, say , it can be used as follows: <\shell-code> chmod u+x mean ./mean 3.2 5.6 -1.7 \; Mean: 2.36666666667 provided that the command is available. The command to load and use the types and functions exported by an external library is : <\mmx-code> use "package"; Here the dynamic library will be searched in the loading path (see variable or ). The first time the shell is launched it creates a in the home directory. A warning message is printed. The file is automatically loaded at startup. This is the right place to customize the shell and to load the packages you frequently use. In order to load packages you can proceed as follows: <\mmx-code> if supports? "numerix" then use "numerix"; if supports? "algebramix" then use "algebramix"; Prior to user's boot file a global boot file (usually ) is loaded. In case you wish to disable both boot files use the option within the command. Within an interactive session, ending a line with a '' actually means finishing with a null instruction. As a consequence this extra '' prevents from printing the output of the previous instruction. Help on functions and types can be obtained with the command: <\session|mathemagix|default> <\unfolded-io> <|unfolded-io> help Generator Generic <|unfolded-io> >>>> <\unfolded-explain|Available functions> Boolean> Boolean> Generator (Generic)> Alias (Generator (Generic))> Syntactic> > <\unfolded-io> <|unfolded-io> help infix + <|unfolded-io> <\text> Int>> Double>> Syntactic>> . If you don't have this file, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.> <\initial> <\collection>