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

Issue: TAILP-NIL (version 1)



Issue:		TAILP-NIL
References:	TAILP (p 275 of CLtL)
Category:	CLARIFICATION/CHANGE
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
   LDIFF."

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

  (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.

Benefits:

  A slightly more precise description of the language.

Discussion:

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