chickadee » srfi-252 » pair-generator-of

pair-generator-of subgenerator-car #!optional subgenerator-cdrprocedure

Create an infinite generator that returns pairs. The contents of the pairs are values generated by the subgenerator-car, and if specified, subgenerator-cdr arguments. If both subgenerator arguments are specified, subgenerator-car will populate the car, while subgenerator-cdr will populate the cdr of the pair. If the subgenerator-cdr argument is not specified, subgenerator-car will be used to generate both elements of the pair.

    (define pair-gen
      (pair-generator-of (integer-generator) (boolean-generator)))

    (pair-gen) ; => '(0 . #t)