[r6rs-discuss] Improper lists (pattern matching)
r6rsguy at free-comp-shop.com
Fri Feb 15 22:47:24 EST 2008
> From: "R. Kent Dybvig" <dyb at cs.indiana.edu>
> If I understand the issue, I think this boils down to
> asking whether 123 is considered an improper list
> and, if so, whether its last cdr is 123. Right? If
> so, I can tell you that such was the intended
> It would have been better to make this intention more
> clear. That 123 qualifies as an improper list is
> consistent with the definition of improper list given
> in Section 11.9 as "a chain of pairs not ending in
> the empty list", assuming such a chain can be empty.
> It is also consistent with the usage of the term in
> the description of append. But it's questionable
> whether an empty chain of pairs can have a "last
If this is the intention, then the whole definition and
use of the term "improper list" seems to be just
An improper list is just anything that is not a list.
The only uses of the term (other than in the examples
following the definition) are in the description of
pattern matching just dissected, and of the |append|
procedure. There we see:
(append list ... obj}
Returns a possibly improper list consisting of the
elements of the first list followed by the elements
of the other lists, with obj as the cdr of the
An improper list results if obj is not a list.
So this should be in the examples:
(append 'z) ==> z
Perhaps the examples following the definition of
"improper list" should have the example
'( . z) is equivalent to 'z
to make it clear that the chain of pairs can be empty.
In any case, the term applies only to this abbreviated
dotted pair notation, and applies to (internal) objects
only in so far as we need a special term for "not a
list", and there must be a better term for that.
More information about the r6rs-discuss