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

Issue: TAILP-NIL (version 1)

References:	TAILP (p 275 of CLtL)
Edit History:	13-Sept-88, version 1 by Walter van Roggen

Problem Description:

  CLtL, in the description of TAILP, states:
    (TAILP sublist list)
  "is true if (NTHCDR n list) is sublist, for some value of n.  See

  However, the behavior when sublist is NIL is not what was intended,
  as implied by the description of LDIFF and a common definition of

  (defun tailp (sublist list)
    (do ((list list (cdr list)))
        ((null list) nil)
      (if (eq sublist list)
          (return t))))

Proposal: (TAILP-NIL:NIL)

  (TAILP NIL X) returns NIL for all lists X.  Qualify the description
  in CLtL by saying that:
    (TAILP sublist list)
  "is true if (NTHCDR n list) is sublist for some value of n, if sublist
   is a non-null list, and is false if sublist is NIL."

Current Practice:

  This is probably what all implementations already do.

Cost to Implementors:

  An implementation is given in the Problem Description.

Cost to Users:

  Unlikely to affect any portable code, due to the Current Practice.


  A slightly more precise description of the language.


  This first appeared in ">GLS>clarifications.text" of 12/06/85.