[racket-dev] stream confusion

From: Martin Neal (marty.neal at gmail.com)
Date: Wed Aug 22 17:04:36 EDT 2012

What timing, I was in the middle of writing the same question to the list
when I got this.  I can only add that the problem is also present in
5.3.0.20, and that, if I take (for instance, the stream-map) definition in
racket/stream and execute it again, stream-map begins working as expected
again.  Maybe a problem with generics?

On Wed, Aug 22, 2012 at 1:49 PM, Stephen Chang <stchang at ccs.neu.edu> wrote:

> 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
>
> _________________________
>   Racket Developers list:
>   http://lists.racket-lang.org/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20120822/81f0af0f/attachment.html>

Posted on the dev mailing list.