[erlang-questions] What is wrong with this list?

David Terrell <>
Wed Sep 12 15:38:49 CEST 2007


On Tue, Sep 04, 2007 at 09:05:27PM +0100, David Hopwood wrote:
> Hmm -- aren't improper lists almost always an error? Why are they allowed?
> (Static typing isn't needed to prevent them, and the performance argument
> against checking that each tail is a cons cell or nil is weak; it is an
> O(1) tag check that can often be optimized out.)

This was fresh enough in my mind that when I recently solved a problem
I was having, I wanted to come back and mention it.

here's an example of a valid, and useful, 'improper' list:

MatchPattern = [Key1, Key2 | '_'].

-- 
David Terrell

((meatspace)) http://meat.net/



More information about the erlang-questions mailing list