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.