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

length



In addition to your list of quotes from CLtL pertaining to (LENGTH '(3 . 3)),
I refer you to page 265, which says that "LIST-LENGTH could be implemented
as follows:

  (defun list-length (x)
    (do ((n 0 (+ 2 n))
         (fast x (cddr fast))
         (slow x (cdr slow)))
        (nil)
     (when (endp fast) (return n))
     (when (endp (cdr fast)) (return (+ n 1)))
     (when (and (eq fast slot) (> n 0)) (return nil))))
"

The use of 'endp' here seems to imply that Lucid's implemention is not
in conformance with CLtL.  The decision to admit non-standard lists
everywhere in the sequence functions was taken long before my coming
to Lucid, and no one now seems to remember exactly why it was decided
that way.  But I have heard claims that the matter was discussed with 
Guy Steele in the fall of 1984, and he concurred (so goes the claim) 
that signalling an error on non-standard lists isn't required.

-- JonL --