Matthias Lang wrote:
> Matt> > It's possible to see it the other way around. Cons cells are
> Matt> > universal. ^^^^^^^^^^
>> James> True. But the way I see it, the fundamental difference is that lists
> James> are designed... ^^^^^
>> All lists are made of cons cells.
> But not all cons cells are part of a list.
>> Wasn't that the whole point?
Depends on the language. In Haskell for example, and in other languages
where cons cells are defined as the algebraic data type
List t ::= Nil | Cons t (List t),
lists are always proper.
>http://www.gigamonkeys.com/book/beyond-lists-other-uses-for-conses.html
This representation of trees uses only proper lists (where each list is the
right spine of the corresponding subtree).
--
David Hopwood <>