emacs-devel
[Top][All Lists]
Advanced

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

Re: Predicate for true lists


From: Paul Eggert
Subject: Re: Predicate for true lists
Date: Fri, 6 Jul 2018 10:30:08 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

address@hidden proper-list-length object
+This function returns the length of @var{object} if it is a proper
+list, @code{nil} otherwise.  In addition to satisfying @code{listp}, a
+proper list is neither circular nor dotted.

Please mention here that the function can be used as a predicate; otherwise, that fact would be documented only in NEWS. Also, as Eli suggested, mention the same thing in the doc string.

-       (let ((a-proper-p (ert--proper-list-p a))
-             (b-proper-p (ert--proper-list-p b)))
-         (if (not (eql (not a-proper-p) (not b-proper-p)))
+       (let ((a-proper-p (proper-list-length a))
+             (b-proper-p (proper-list-length b)))
+         (if (not (eq (not a-proper-p) (not b-proper-p)))
              `(one-list-proper-one-improper ,a ,b)
            (if a-proper-p
-               (if (not (equal (length a) (length b)))
+               (if (/= (length a) (length b))

This computes the lengths of A and B twice; just compute it once.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]