1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
_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 [script]
where `script' (optional parameter) is the pathname of a file containing
a set of Miranda definitions. If no script is specified a default name
`script.m' is assumed. The named script (script.m by default) becomes
your _c_u_r_r_e_n_t _s_c_r_i_p_t, during the ensuing Miranda session. You can change
your "current script" during a session, but at any time there is a
unique filename which is current.
Note that a file containing a Miranda script is expected to have a name
ending in `.m' and the `mira' command will add this extension if
missing. So `mira stuff' will be interpreted as `mira stuff.m'. It is
a convenient and widely used convention 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 any scripts which it `includes' (see library
directives) plus the names of the _s_t_a_n_d_a_r_d _e_n_v_i_r_o_n_m_e_n_t, which is always
in scope. The current script may be an empty or non-existent file if
you have not yet put any definitions in it. In this case just the names
of the standard environment will be in scope.
The prompt `Miranda' indicates that you are talking to the Miranda
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.
??identifier
Opens the relevant source file at the definition of identifier, which
may be any currently in scope. Try for example ??map
For this and several other features to work Miranda must be configured
to use an appropriate editor - the default is vi, but you can change
this. See section 31 subheading 5 of this manual ("How to change the
default editor").
!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 currently installed editor
(default _v_i, to change this see remark under ?? above). On quitting the
editor, if changes have been made to any relevant source file, the
Miranda system automatically recompiles the current script and any other
scripts on which it depends and which have been updated.
/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 (on most UNIX-like systems) Miranda understands the
commonly used `~' convention in pathnames. That is ~/file means file in
your home directory, and ~jack/file means file in jack's home directory.
/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 missing.
Important special case - reselecting the current script, eg by saying
/f %
forces the current script to be RECOMPILED - this is useful if script
has errors and you wish to see the error messages again.
/help (also /h)
Display summary of main available commands. There are a few less used
auxiliary commands, not covered here /aux (or /a) will summarise these.
/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 as a list.
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.
|