[plt-scheme] v4 questions

From: Eli Barzilay (eli at barzilay.org)
Date: Sun Mar 30 22:41:00 EDT 2008

On Mar 30, Doug Orleans wrote:
> Eli Barzilay writes:
>  > >   (define-syntax (for/stream stx)
>  > >     [...])
>  > 
>  > I have never seen a practical need for something like this (where
>  > by "this" I mean a general facility to turn a sequence of
>  > side-effects into a stream of values).
> 
> A for/stream expression doesn't have to involve side-effects-- it's
> just a (potentially) more concise way to generate a stream.  Compare
> the following:
> 
> (for/stream ((x (in-naturals))) (f x))
> (let loop ((x 0)) (stream-cons (f x) (loop (+ x 1))))

My answer to that is obvious -- I'd have a `naturals' stream, and
simply use

  (map f naturals)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.