chickadee » srfi-158 » gmap

gmap proc gen1 gen2 ...procedure

When only one generator is given, returns a generator that yields the items from the given generator after invoking proc on them.

When more than one generator is given, each item of the resulting generator is a result of applying proc to the items from each generator. If any of input generator is exhausted, the resulting generator is also exhausted.

Note: This differs from generator-map->list, which consumes all values at once and returns the results as a list, while gmap returns a generator immediately without consuming input.

(generator->list (gmap - (make-range-generator 0 3)))
 ⇒ (0 -1 -2)

(generator->list (gmap cons (generator 1 2 3) (generator 4 5)))
 ⇒ ((1 . 4) (2 . 5))