summaryrefslogtreecommitdiff
path: root/miralib/manual/10
blob: d4d48b96e26479d34e5cf467229e30521d72d6ab (plain)
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
_I_d_e_n_t_i_f_i_e_r_s

An identifier consists of a letter followed by zero or  more  additional
characters  which  may  be  letters  digits  or  occurrences  of  _ or '
(underscore and single quote) Examples:
        x  yellow  p11d  y'  GROSS_INCOME
Note that both upper and lower case letters are allowed,  and  they  are
treated  as different, so x and X are not the same identifier.  There is
no restriction on the length of identifiers, and all the characters  are
significant   in   deciding   whether  two  identifiers  are  the  same.
Identifiers fall into two different classes (called in the formal syntax
`identifier' and `IDENTIFIER') depending on whether their initial letter
is upper or lower case.

Identifiers are used for three different purposes in Miranda  -  (i)  as
variables,  i.e.  names for values (note that the names of functions are
also considered to be variables), (ii) as typenames, such as `bool'  and
`char', and (iii) as constructors (see section on algebraic types).  The
names of constructors must  begin  with  an  upper  case  letter,  while
variables  and typenames must begin with a lower case letter.

Reserved  words  -  the  following  are  special  symbols of the Miranda
language.

_a_b_s_t_y_p_e _d_i_v _i_f _m_o_d _o_t_h_e_r_w_i_s_e _r_e_a_d_v_a_l_s _s_h_o_w _t_y_p_e _w_h_e_r_e _w_i_t_h
 (10)

These are often shown as underlined (or bold)  in  published  documents,
but in programs they are typed as ordinary lower case words (which means
that these words cannot be used as identifiers).

_P_r_e_d_e_f_i_n_e_d_ _i_d_e_n_t_i_f_i_e_r_s

The following identifiers are normally* predefined and always in  scope.
They  constitute  the  `standard  environment'.  They are defined in the
script "stdenv.m", contained in the directory /usr/lib/miralib.

(a) predefined typenames
    bool char num sys_message

(b) predefined constructors
    False True :: bool
    Appendfile Closefile Exit Stderr Stdout System Tofile :: sys_message

(c) predefined variables
    abs and arctan cjustify code concat const converse cos decode  digit
    drop dropwhile e entier error exp filemode filter foldl foldl1 foldr
    foldr1 force fst getenv hd hugenum id  index  init  integer  iterate
    last  lay  layn  letter  limit lines ljustify log log10 map map2 max
    max2 member merge min min2 mkset neg numval or  pi  postfix  product
    read  readb  rep  repeat reverse rjustify scan seq showfloat showhex
    shownum showoct showscaled sin snd sort  spaces  sqrt  subtract  sum
    system take takewhile tinynum tl transpose undef until zip zip2 zip3
    zip4 zip5 zip6 (91)

See manual entry `Standard environment' for a listing of  its  contents.

[*You can suppress automatic inclusion of <stdenv> by  calling  mira  with
  flag  "-stdenv".  See manual section 31/7 "Options, setup files etc"]