chickadee » srfi-40 » stream-cons

stream-cons object streamprocedure

stream-cons is the primitive constructor of streams, returning a stream with the given object in its car field and the given stream in its cdr field. The stream returned by stream-cons must be different (in the sense of eqv?) from every other Scheme object. The object may be of any type, and there is no requirement that successive elements of a stream be of the same type, although it is common for them to be. It is an error if the second argument of stream-cons is not a stream.

(stream-cons 'a stream-null)                => (stream 'a)
(stream-cons 'a (stream 'b 'c 'd))          => (stream 'a 'b 'c 'd)
(stream-cons "a" (stream 'b 'c))            => (stream "a" 'b 'c)
(stream-cons 'a 3)                          => error
(stream-cons (stream 'a 'b) (stream 'c))    => (stream (stream 'a 'b) 'c)