From: Tim Bradshaw
Subject: Series type problems
Date: 
Message-ID: <ey3n2w26nw4.fsf@staffa.aiai.ed.ac.uk>
Having being enthused by SICP's stream stuff, and written my own
delayed-eval thing, I've been playing with the SERIES package (I'm
using the one from the CMU AI repository, which is November 26, 1991).
I'm using CMUCL.

Unfortunately there seem to be type problems which prevent it working
well on CMUCL.  The most trivial example I can find is:

    (defun foobly-series ()
      ;; an infinite sequence of 1s slowly
      (declare (optimizable-series-function))
      (scan-fn 'fixnum
	       (lambda ()
		 1)
	       (lambda (prev)
		 prev)))

    (defun foobly (n)
      ;; get the nth term of FOOBLY-SERIES (will be 1!)
      (collect-nth n (foobly-series)))

FOOBLY-SERIES expands to some enormous thing, which at some point
assigns NIL to something declared FIXNUM, which CMU barfs at
(reasonably).

I can fix it by weakening the type to T or something but that means I
haven't a hope of getting reasonable numeric code.  I can't understand
the code enough to see what the problem is.

Either I'm doing something silly, or there's a bug somewhere in
there.  Does anyone know if there is a fix for this?

Thanks

--tim

PS please send a mail copy of any followup as I'm about to be away for
more than the spool's half-life.