[plt-scheme] v4 questions

From: Doug Orleans (dougorleans at gmail.com)
Date: Sun Mar 30 21:03:50 EDT 2008

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))))

--dougorleans at gmail.com

Posted on the users mailing list.