[alexandria-devel] length=1
Attila Lendvai
attila.lendvai at gmail.com
Fri Feb 22 09:09:50 UTC 2008
dear list,
is there any objections against this?
(declaim (inline length=1))
(defun length=1 (sequence)
(if (listp sequence)
(and sequence
(null (rest sequence)))
(= 1 (length sequence))))
in optimized code, where type information is available, it drops the
type check. and otherwise it works for sequences and is fast for
lists.
maybe it could be extended into two functions: length= and length=1,
where length= optimizes for lists using nthcdr.
--
attila
More information about the alexandria-devel
mailing list