[clean-list] list: atom?

RT Happe rthappe@mathematik.uni-freiburg.de
Wed, 27 Nov 2002 19:16:21 +0100 (CET)


On Mon, 25 Nov 2002, Maks Verver wrote:
> functiones operating on 'real' lists. You may think of Clean lists as
> being algebraic datatypes that use 2-tuples already, something along the
> lines of:
>
> ::List type = (type, List type) | EmptyList

I don't think this definition is correct Clean.  Anyway, I'd prefer

::List t = Cons t (List t) | Nil

where the data constructor Cons corresponds to Scheme's procedure of the
same name and Nil to Scheme's list terminator '().

> matching of lists is useful (just as in Scheme) but I don't know why
> functions accepting 2-tuples can't accept lists (or the other way
> around). Does anyone have an idea about this?

Probably because list's aren't tuples.

Probably