chickadee » srfi-252 » exact-rational-generator

exact-rational-generatorprocedure

Create an infinite generator that returns objects that fulfill the exact? and rational? predicates. The generator should return the sequence

    0 1 -1 1/2 -1/2

first, then a uniformly random distribution of exact rational numbers. Elements of the above sequence may be omitted if they are not distinguished in the implementation.

    (define exact-rational-gen (exact-rational-generator))

    (exact-rational-gen) ; => 0