[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Should the car be a stream?



The following seems wrongly typed to me:

(define-syntax stream-cons
    (syntax-rules ()
      ((stream-cons obj strm)
        (stream-delay (make-stream-pare
                          (stream-delay obj)   ;???
                          (stream-lazy strm))))))

Specifically, I don't think the car of a stream should be a stream. Instead, shouldn't it be something like

(define-syntax stream-cons
    (syntax-rules ()
      ((stream-cons obj strm)
        (stream-delay (make-stream-pare
                          (delay obj)
                          (stream-lazy strm))))))

But even I am wondering about the rationale for making the stream elements themselves promises. It may be useful to leave the types of the elements (including whether they are promises or ordinary values) orthogonal to the
backbone of the stream itself.

I suspect that if the elements were not themselves delayed by default, you would see a huge difference in performance.

Andre