[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] coops

From: Thomas Chust
Subject: Re: [Chicken-users] coops
Date: Wed, 19 Jan 2011 14:23:00 +0100

2011/1/19  <address@hidden>:
> [...]
> Jeha, i know. A list is a pair, but a pair is not a list. Therefore a list
> should be a subclass of pair. (Ok, for '() we have <null>).
> [...]


that is wrong, and you even give the reason why it's wrong yourself: A
list is either a pair or the empty list. Hence the singleton type of
the empty list and the type of all pairs are subtypes of the type of
lists, but not vice versa.

If the type of lists was a subtype of the type of pairs, every list
would have to be a pair, but that is not true since the empty list is
not a pair. This is one of the subtle differences between Scheme and
Common Lisp, where the car and cdr operations are also applicable to
the empty list (resulting in the empty list again).


When C++ is your hammer, every problem looks like your thumb.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]