_T_h_e_ _M_i_r_a_n_d_a_ _c_o_m_m_a_n_d_ _i_n_t_e_r_p_r_e_t_e_r

The Miranda system is invoked from unix by the command
        mira [file]
where  `file'  (an  optional  parameter)  is  the  pathname  of  a  file
containing a Miranda script (i.e.  a set of definitions).  If no file is
given a default filename `script.m' is assumed.  The  parameter  of  the
mira  command  (or  script.m  by  default)  becomes your current script,
during the ensuing Miranda session.

Note that a file containing a Miranda script must have a name ending in
`.m'  and  the  `mira'  command will add this extension automatically if
absent.  That is if you say `mira thing', it will be  interpreted  as  a
reference  to  the file `thing.m'.  It is a UNIX convention (which often
turns out to be useful) that files  containing  program  sources  should
have names indicating which language they are written in.

The set of names in scope at any time are those of the  current  script,
together with the names of the standard environment, which are always in
scope.

The prompt `Miranda' indicates that  you  are  talking  to  the  Miranda
command  interpreter.   This  activity  is called a Miranda ``session''.
Each command should be typed on a single line, following the prompt, and
is entered by hitting return.  Any command not beginning with one of the
special characters `/', `?', or `!' is assumed to be an expression to be
evaluated.  The following commands are available during a session.

exp
 Any Miranda expression typed on a line by itself is evaluated, and  the
value  is  printed  on the screen.  If the value is of type [char] it is
printed literally, otherwise the special function `_s_h_o_w' is  applied  to
it to convert it to printable form.  Example
  Miranda sum[1..100]
  5050 (response)

There  is a special symbol $$ which is always set to the last expression
evaluated.  So after the above command $$ will have the value 5050,  and
this  can  be used in the next expression - e.g. `$$/2' will produce the
response 2525 (and the value of `$$' is now 2525).

exp &> pathname
 A background process is set up  to  evaluate  exp,  and  the  resulting
output (including error messages, if any) sent to the designated file.

exp &>> pathname
 As  above,  except  that the output is appended to the designated file,
instead of replacing its previous contents.

exp::
 Print the type of the expression (instead of the  value).   Useful  for
investigating the type structure of a script.

?
 Lists  all  identifiers  currently in scope, grouped by file of origin,
starting with the standard environment.

?identifier(s)
 Gives more information about any  identifier  defined  in  the  current
environment  (namely  its  type  and the name of the file in which it is
defined).   This  command  will  also  accept  a  list  of  identifiers,
separated by spaces.

!command
 Execute any UNIX shell command.

!!
 Repeat last shell command.

Note that the character `%' can be used in any Miranda session  command,
including  a  `!'  command,  as  an abbreviation for the pathname of the
current script.  So for example
	!wc %
does a word count on the current script.  (If for some reason  you  need
to  include a literal % character in a command, you can escape it with a
preceding backslash.)

All  the  remaining  commands  begin  with  `/'.   Each of the following
commands can be abbreviated to its first letter.

/edit (also /e)
 Edit the current script.  Calls up the screen editor  `vi'.   (This  is
the  default, but another editor can be substituted - see manual section
on UNIX/Miranda system interface).  On quitting the editor,  if  changes
have  been  made  to  any  relevant  source  file,  the  Miranda  system
automatically recompiles the current script before returning you to  the
Miranda  command  interpreter.   This check is performed after all /edit
commands and also after each shell escape.

[An alternative mode of operation, possible on a windowing system, is to
keep  an  editor  window  and a Miranda session window both open, rather
than using the /e command.  In this case you should set  an  environment
variable  RECHECKMIRA  (to  any  non-empty string) - this will cause the
Miranda  system  to  check  for  source  file   updates   before   every
interaction,  instead  of only after /e and ! commands.]

/edit pathname (also /e pathname)
 Edit arbitrary script.  Note that the pathname should end in  `.m'  and
that this will be added if missing.

Note by the way that (if you are using a Berkeley UNIX, or a derivative)
Miranda  understands  the  cshell's  ~ convention in pathnames.  That is
~/file means file in your home directory, and ~jack/file means  file  in
jack's home directory.  This doesn't work under system 5 (sorry).

/file (also /f)
 Print the name of file containing the current script.

/file pathname (also /f pathname)
 Change to new current  script.   Equivalent  to  quitting  the  Miranda
system  and  reinvoking it with a new sourcefile.  Like /e, /f adds ".m"
to the end of the filename if you omit it.

Important special case - reselecting the current script, eg by saying
	/f %
forces the current script to be RECOMPILED  -  this  can  be  useful  if
script has errors and you wish to see the error messages again.

/help (also /h)
 Display summary of main available commands.

/man (also /m)
 Enter online manual system.

/quit (also /q)
 Quit the Miranda system.  Typing the end of file character  (control-D)
also has this effect.

Finally note that $- and $+ are allowed as notations  for  the  standard
input  in  Miranda  expressions.   The  standard  input  as  a  list  of
characters is denoted by `$-'.  As  a  simple  example,  evaluating  the
expression
	reverse $-
causes  everything  typed  at the keyboard upto the next control-D to be
echoed backwards.

The notation `$+' also denotes the standard input, but as a sequence  of
Miranda  expressions  (one  per  line),  and  returns their values.  For
example
	sum $+
reads a sequence of numeric expressions from  the  standard  input,  and
returns the sum of their values.  See the manual section on reading with
interpretation  (under  UNIX/Miranda  system  interface)   for   further
information.

