[Top][All Lists]

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

Cheap list? (was: [PATCH] Fix serialization of #nil-terminated lists dur

From: David Kastrup
Subject: Cheap list? (was: [PATCH] Fix serialization of #nil-terminated lists during compilation)
Date: Sat, 14 Jan 2012 10:15:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Mark H Weaver <address@hidden> writes:

> FYI, bipt mentioned this bug on IRC:
> <bipt>(compile '(cdr '(5 . #nil)) #:to 'value) => ()
> <bipt>(cdr '(5 . #nil)) => #nil
> and I pushed the attached fix to stable-2.0.

Oh, by the way: the Lisp predicate listp (at least Elisp) is

listp is a built-in function in `C source code'.

(listp OBJECT)

Return t if OBJECT is a list, that is, a cons cell or nil.
Otherwise, return nil.


That is a computationally cheap predicate.  I don't see an equivalent in
Guile: list? checks a narrower condition, and it is O(n) instead of O(1).

Quite often the circularity check is not actually wanted.  Is there
any recommended way to do the equivalent of (or (pair? x) (null? x))?

David Kastrup

reply via email to

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