From: Olaf Bachmann
Subject: [Q]: Dotted vs Ordinary Lists
Date: 
Message-ID: <3ld0mk$2m3@ns.mcs.kent.edu>
I noticed that certain list operations (like list-length, last, butlast) work 
only on ordinary lists and not on dotted lists in AKCL/GCL. According to CLTL1,
a _list_ is either an ordinary list (i.e. last cdr is NIL) or a dotted list
(i.e. last cons is a non-nil atom). It furthermore is not explicitely said 
about list functions for which types of lists they are defined. Hence, I read
this as they should work on all lists. On the other hand, the implementation of
list-length suggested in CLTL1 would fail for dotted lists. 

So is AKCL/GCL incorrectly implemented or am I missing something or do I really
have to implement my own list-length function which also works on dotted lists?

Thanks,
Olaf

-- 
______________________________________________________________________
Olaf Bachmann                    email: ········@mcs.kent.edu        
Ph.D. Student                    phone: (216) 672-4004 ext:203
Kent State University            home : (216) 678-7538                
Dept. of Mathematics and Computer Science                 
Kent, Ohio 44242, U.S.A.                                              
URL: http://www.mcs.kent.edu/~obachman                      
______________________________________________________________________

Mathematicians are like Frenchmen:  whenever you say something to them,
they translate it into their own language, and at once it is something
entirely different.                                    J. W. v. GOETHE
From: Barry Margolin
Subject: Re: [Q]: Dotted vs Ordinary Lists
Date: 
Message-ID: <3lda0f$825@tools.near.net>
In article <··········@ns.mcs.kent.edu> ········@tiger.mcs.kent.edu (Olaf Bachmann) writes:
>It furthermore is not explicitely said 
>about list functions for which types of lists they are defined. Hence, I read
>this as they should work on all lists.

This is incorrect; most list functions are only required to work on true
lists.  See section 2.4 of CLtL2:

    Often the term <list> is used to refer either to true lists or to
    dotted lists.  When the distinction is important, the term "true list"
    will be used to refer to a list terminated by NIL.  Most functions
    advertised to operate on lists expect to be given true lists.
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Throughout this book, unless otherwise specified, it is an error to
    pass a dotted list to a function that is specified to require a lists
    as an argument.

I opine that the second sentence of that paragraph is blatantly false,
since the rest of the paragraph indicates that the term "list" is often
used when the distinction is important -- in fact, critical.  It's probably
the one that Olaf remembered, resulting in his incorrect expectations.
-- 
Barry Margolin
BBN Planet Corporation, Cambridge, MA
······@bbnplanet.com