[erlang-questions] List pipe syntax
Tue Dec 19 08:24:33 CET 2006
Alexander Harju wrote:
> I have a question about the pipe syntax when building lists.
> According to the Erlang reference a list is either the empty list  or
> consists of a head and a tail which is also a list. [Head|Tail].
> I've noticed that you can do some weird "list"-building using the pipe
> [1|] is obviously a list according to the definition since  is a list.
> But what about [1|2]??. This shouldn't evaluate to a list since 2 isn't a
Note that also according to the reference:
"A list where the tail is a list is sometimes called a proper list. It is
allowed to have a list where the tail is not a list, for example [a|b].
However, this type of list is of little practical use."
More information about the erlang-questions