[erlang-questions] Irregular list

Joe Armstrong erlang@REDACTED
Thu Feb 12 16:30:18 CET 2009


This is a "improper list".  A list is really just a cons cell (think
lisp, or think
"liknked list" in C) - internally it's a pair
of tagged values - the first value in the pair is the head of the
list. The second value
is the tail of the list, an so should point to a list or nil. If the
tail points to
nil or a list then it is a proper list, otherwise it's an improper list.
Most library functions will behave strangely when presented with improper
lists - so don't use them!

/Joe Armstrong

2009/2/12 Ladvánszky Károly <lk@REDACTED>:
> Just getting acquainted with this wonderful system, I’ve run into the
> following issue:
>
>
>
> The shell seems to accept a structure like this: [a | b].
>
>
>
> is_list([a | b]) returns true but length([a | b]) raises an exception.
>
>
>
> Is it like an “open list” found in some programming languages?
>
>
>
>
>
>
>
> Any help would be appreciated,
>
>
>
> LKaroly
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list