Next: , Previous: , Up: Syntax   [Contents][Index]

3.6 Lists

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.


[Head,..]    % shorthand for [Head,.. _]  with _ the anonymous variable

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.