Next: List comprehension expressions, Previous: Function calls, Up: Syntax [Contents][Index]
A list is a comma separated sequence of expressions enclosed in "[".."]" brackets. This is a complete list. Or it is a comma separated sequence of terms ending with ,.. optionally followed by a variable, or ending with |) always followed by a variable, enclosed in "[".."]" brackets.
Example:
[3,2.7,X*Y,"hello"] [3,4,..Tail] [Head,..Tail] [Head,..] % shorthand for [Head,.. _] with _ the anonymous variable [Head|Tail]
The first example is a complete enumeration and the remaining examples are list patterns in which both ,.. and | can be read as "followed by". The fourth example is equivalent to [Head,.. _].
The last example is using the Prolog syntax for a list.