Improper lists [was: Dialyzer v1.3.0 released]

Matthias Lang matthias@REDACTED
Tue Mar 29 09:16:12 CEST 2005


James Hague writes:

 > But is [a|b], when used to store two arbitrary values, an efficiency
 > hack or simply taking full advantage of cons cells?  Certainly {a,b}
 > is more, uh, "Erlangian."

It's possible to see it the other way around. Cons cells are
universal. Build whatever you want with them: lists, trees, ... It's
tuples that are the efficiency hack with the arbitrary size limit.

Why not go fully erlangian and eliminate cons cells entirely and
just use tuples for everything, i.e. "String" could be sugar for

  {$S, {$t, {$r, {$i, {$n, {$g, {}}}}}}}

you could even include the length of the tail at every step for added
popularity ;-)

Matt



More information about the erlang-questions mailing list