[plt-scheme] stop-before vs. #:while

From: Doug Orleans (dougorleans at gmail.com)
Date: Sun Mar 16 19:56:18 EDT 2008

I'm finding stop-before to be kind of awkward:

(for/list ((i (stop-before (in-naturals) (lambda (i) (>= (* i i) 25))))) i)
=> (0 1 2 3 4)

It's a little verbose, plus you have to redundantly name the loop
variable i.  I think I would prefer something like the following,
analogous to #:when:

(for/list ((i (in-naturals)) #:while (< (* i i) 25)) i)

Is this feasible?

--dougorleans at gmail.com


Posted on the users mailing list.