chickadee » srfi-252 » exact-number-generator

exact-number-generatorprocedure

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

    0 1 -1 1/2 -1/2 0+i 0-i 1+i 1-i -1+i -1-i
    1/2+1/2i 1/2-1/2i -1/2+1/2i -1/2-1/2i

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

    (define exact-gen (exact-number-generator))

    (exact-gen) ; => 0