[erlang-questions] Irregular list
Jachym Holecek
freza@REDACTED
Thu Feb 12 19:53:40 CET 2009
# Mihai Balea 2009-02-12:
> Is there any practical use of "improper lists" in Erlang?
A 2-tuple is larger than a cons-cell by one word (or 50% if you
prefer :-), so choosing cons over 2-tuple makes practical sense
if you're about to work with a huge amount of pairs. The dict
module from stdlib seems to be an example.
Note this argument isn't inherent to the problem: With some amount
of work, you could probably tweak erts to represent 2-tuples without
the extra overhead.
Other than size, someone has recently proposed a new function for
a stdlib module (sorry, I forgot the details) that used improper
lists, and after reading the explanation, it felt very intuitive
(more so than the 2-tuple based analogy). So forbidding improper
lists altogether might perhaps be something to regret later on.
Just my two cents, anyway.
-- Jachym
More information about the erlang-questions
mailing list