[racket-dev] PLaneT Library of Iterations/Comprehensions

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Wed Aug 18 14:39:46 EDT 2010

On Wed, Aug 18, 2010 at 12:02 PM, Will M. Farr <wmfarr at gmail.com> wrote:
> Hello all,
>
> I've been thinking for a while about putting together a PLaneT library of some iteration/comprehension forms that I often use that are not found in the racket core.  Right now, I have a small it-comp.plt local PLaneT package that contains
>
> for/vector
> for/flvector
> in-flvector

Great!

> The for/... forms have the option of having a first expression that gives the length of the resulting object (similar to srfi-42's vector-of-length-ec form) to allow generating more efficient code:
>
> (for/vector ((x (in-range 3))) x) => (vector 0 1 2)
> (for/vector 3 ((x (in-range 3))) x) => (vector 0 1 2) ; but more efficiently

What does this do if the specified length is wrong?

> Alternately, if you guys want to add these to the core, I'd be happy to contribute code and tests....

If you prepare a patch (with tests/docs) I'll get it committed.
-- 
sam th
samth at ccs.neu.edu


Posted on the dev mailing list.