. / \ 1 . / \ 2 . / \ 3 which could be written using the standard syntax, as:
.(1,.(2,.(3,)))but which is normally written in a special list notation, as:
[1,2,3]Two examples of this list notation, as used when the tail of a list is a variable, are:
[Head|Tail] [foo,bar|Tail]which represent the structures:
. . / \ / \ Head Tail foo . / \ bar Tailrespectively.
Note that the usual list notation [H|T] does not add any new power to the language; it is simply a notational convenience and improves readability. The above examples could have been written equally well as:
For convenience, a further notational variant is allowed for lists of integers that correspond to ASCII character codes. Lists written in this notation are called strings. For example,
"I am a HiLog string"represents exactly the same list as: