[racket-dev] stream confusion

From: Stephen Chang (stchang at ccs.neu.edu)
Date: Wed Aug 22 16:49:11 EDT 2012

I've been playing with Racket streams and I am confused about what
exactly counts as a stream? For example, are lists streams? I think
the answer is yes but then are the stream- functions supposed to work
on regular lists? Some do but some don't.

Welcome to DrRacket, version 5.3.0.16 [3m].
Language: racket [custom].
> (stream-map (λ (x) x) null)
. . plt/collects/racket/stream.rkt:113:0: stream-accessor: contract violation
  expected: stream?
  given: '()
> (stream? null)
#t
> (stream-map (λ (x) x) (list 1 2))
. . plt/collects/racket/stream.rkt:113:0: stream-accessor: contract violation
  expected: stream?
  given: '(1 2)
> (stream? (list 1 2))
#t
> (stream-first (list 1 2))
1


Posted on the dev mailing list.