[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Nil is a sequence
From: Quiroz Gonzalez
Subject: Nil is a sequence
This is a nit discovered due to a typo:
>#1a()
Error: NIL is not a sequence.
Error signalled by SYSTEM:SHARP-A-READER.
I am reasonable sure (upon careful exegesis of p.357) that my typo
should have produced a vector of size zero. [If not persuaded,
consider (make-array 0 :initial-contents ())]
Even if this interpretation is not right, the error message lies.
= Cesar
There were several bugs related to this error.
1. There was a bug in the definition of the Lisp function SHARP-A-READER
in file lsp/iolib.lsp. To fix the bug, replace the ELT expression
(elt ic 0)
with
(if (zerop (length ic)) ic (elt ic 0))
2. There was a bug in the definition of the C function elt
in file c/sequence.d. To fix the bug, add the following line (marked =>)
in the definition.
default:
=> if (seq == Cnil) goto E;
FEerror("~S is not a sequence.", 1, seq);
Incidentally, I also found there was a similar bug in the definition of
the C function elt_set in file c/sequence.d. To fix the bug, add the
following line (marked =>) in the definition.
default:
=> if (seq == Cnil) goto E;
FEerror("~S is not a sequence.", 1, seq);
3. There was a bug in the definition of the Lisp function MAKE-ARRAY
in file lsp/arraylib.lsp. To fix the bug, surround the LET expression
(defun make-array (...)
(when ...)
(cond ( ... )
(t
(let (...) (when ...) (when ...) x)
)))
with the following UNLESS expression.
(defun make-array (...)
(when ...)
(cond ( ... )
(t
=> (unless (member 0 dimensions)
(let (...) (when ...) (when ...) x)
=> )
)))
-- Taiichi