Next: , Previous: Compound Terms, Up: Syntax


3.6 Lists

The atom [] represents the empty list.

The syntax of a non-empty Pedro list consists of an opening square bracket followed by a comma separated list of syntax representing Pedro terms (optionally followed by a “|” followed by syntax representing Pedro term) followed by a closing square bracket.

Examples:

     [], [V, a, f(2), [a,b,c], "string'], [H1, H2|T]

The list syntax involving “|” is typically used to describe list patterns. For example, the third example above might be used to match against lists with at least two elements (H1 and H2) and whose tail is T.