seq.lib: Recognize (array /type/ 1) as valid sequence subtype.

Fixes erroneous assumption, that for sequence dimension-spec mustn't
be an atom. '(array t 1) designates simple-vector of any type and
unknown length. Fixes issue #6.

Signed-off-by: Daniel Kochmański <dkochmanski@turtle-solutions.eu>
This commit is contained in:
Daniel Kochmański 2015-05-08 20:05:45 +02:00
parent 7599ca2967
commit fa7ba1f27e

View file

@ -83,13 +83,15 @@
(setq elt-type 'BIT
length (if (endp args) '* (first args))))
((ARRAY SIMPLE-ARRAY)
(when (or (endp (rest args))
(atom (setq length (second args)))
(endp length)
(not (endp (rest length))))
(error-sequence-type type))
(setq elt-type (upgraded-array-element-type (first args))
length (first (second args))))
(let ((dimension-spec (second args)))
(cond
((eql dimension-spec 1)
(setf length '*))
((and (consp dimension-spec)
(null (cdr dimension-spec)))
(setf length (car dimension-spec)))
(T (error-sequence-type type))))
(setq elt-type (upgraded-array-element-type (first args))))
(t
;; We arrive here when the sequence type is not easy to parse.
;; We give up trying to guess the length of the sequence.