[erlang-questions] Irregular list

Mihai Balea mihai@REDACTED
Thu Feb 12 19:12:22 CET 2009

Maybe I'm missing something, but what is the point of even allowing  
the concept of cons cells? Wouldn't a tuple be more generic?
Is there any practical use of "improper lists" in Erlang?


On Feb 12, 2009, at 10:30 AM, Joe Armstrong wrote:

> 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

More information about the erlang-questions mailing list