X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fseq.lisp;fp=src%2Fcode%2Fseq.lisp;h=2cd9d5287ace4d5546742cea1194f927c163b528;hb=22c592cbf7e81e78ceaef80d1c15ad7a7fc3b40a;hp=f2f9cd4df540742ced1f1b99f027bf0468323d13;hpb=f7808fb1c49b729d00580321b3f8457ce4b84cf4;p=sbcl.git diff --git a/src/code/seq.lisp b/src/code/seq.lisp index f2f9cd4..2cd9d52 100644 --- a/src/code/seq.lisp +++ b/src/code/seq.lisp @@ -266,6 +266,16 @@ :type '(and list (satisfies list-length))))) + +(defun emptyp (sequence) + #!+sb-doc + "Returns T if SEQUENCE is an empty sequence and NIL + otherwise. Signals an error if SEQUENCE is not a sequence." + (seq-dispatch sequence + (null sequence) + (zerop (length sequence)) + (sb!sequence:emptyp sequence))) + (defun elt (sequence index) #!+sb-doc "Return the element of SEQUENCE specified by INDEX." (seq-dispatch sequence @@ -851,14 +861,10 @@ many elements are copied." ((eq type *empty-type*) (bad-sequence-type-error nil)) ((type= type (specifier-type 'null)) - (if (every (lambda (x) (or (null x) - (and (vectorp x) (= (length x) 0)))) - sequences) - 'nil - (sequence-type-length-mismatch-error - type - ;; FIXME: circular list issues. - (reduce #'+ sequences :key #'length)))) + (unless (every #'emptyp sequences) + (sequence-type-length-mismatch-error + type (reduce #'+ sequences :key #'length))) ; FIXME: circular list issues. + '()) ((cons-type-p type) (multiple-value-bind (min exactp) (sb!kernel::cons-type-length-info type)