[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Nil is a sequence.
> Date: Sun, 20 Dec 87 01:31:43 -0500
> From: firstname.lastname@example.org
> 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 ())]
I agree. The code in SI:SHARP-A-READER takes one more (elt ic 0)
than it needs to but gets away with it only if ic *has* a 0th elt.
Here is a (somewhat messy) fix:
(defun si:sharp-a-reader (stream subchar arg)
(declare (ignore subchar))
(let ((initial-contents (read stream nil nil t)))
(let ((ic initial-contents)
(do ((i 0 (1+ i)))
((>= i arg)
(make-array (nreverse d) :initial-contents initial-contents))
(push (length (if (> i 0)
(setq ic (elt ic 0))
Unfortunately, a similar problem will still appear in MAKE-ARRAY
if you type something like #2a(()()). Or try
(make-array '(2 0) :initial-contents '(()()))
> Even if this interpretation is not right, the error message lies.
This is ELT's fault. You'll get the same error if you try (elt () 0).
Jeff Dalton, JANET: J.Dalton@uk.ac.ed
AI Applications Institute, ARPA: J.Daltonemail@example.com
Edinburgh University. UUCP: ...!ukc!ed.ac.uk!J.Dalton