ABSTRACT

Miranda is usually invoked by the system command mira and responds with a Miranda prompt, although in the following text this prompt is always shown as a question mark. An expression submitted at the prompt is evaluated and its canonical value returned on the following line. In the simplest case an irreducible value typed at the prompt is returned unchanged:   ?42   42 but if reduction is possible, an expression presented at the prompt is reduced to its equivalent canonical value, e.g. in a subtraction:   ?27 − 14   13 Other arithmetic operations use the familiar infix symbols and can be carried out at the Miranda prompt in the same way: the set of operators {+, −, *, /, ^, div, mod} represents addition, subtraction, multiplication, division, exponentiation, integer division and modulus operators. These built-in operations can be used to build larger expressions such as   ?6^2 − 4*2*3   12 with the usual convention that multiplication and division have greater precedence than either addition or subtraction; exponentiation has the highest precedence of all. Thus the above expression is evaluated as 62 − (4*2*3) and explicit bracketing would be required if this were not the intended meaning. Each of these built-in functions is contained in a standard environment loaded with the Miranda interpreter. A user could invoke Miranda, evaluate some expressions using standard functions and then leave the interpreter by typing/quit at the prompt. The leading / symbol shows that this is a directive to the system rather than an expression to be evaluated.