[racket-dev] PLaneT Library of Iterations/Comprehensions

From: Will M. Farr (wmfarr at gmail.com)
Date: Wed Aug 18 12:02:51 EDT 2010

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


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

I'll be adding more forms from time to time, as I need them.  Eventually, I'll release this to PLaneT, but I thought I might ask the community two questions first:

1. Am I duplicating the functionality of some library?  (If so, I'll just contribute to that instead.)
2. Do you have any iteration "favorites" that I should include in the library?  (Code welcome, but I'm also happy to implement suggestions myself.)

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


Posted on the dev mailing list.