.
/ \
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 Tail
respectively.
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:
.(Head,Tail) .(foo,.(bar,Tail))
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:
[73,32,97,109,32,97,32,72,105,76,111,103,32,115,116,114,105,110,103]