mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-15 13:52:16 -08:00
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:
parent
7599ca2967
commit
fa7ba1f27e
1 changed files with 9 additions and 7 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue