chickadee » srfi-252 » exact-complex-generator

exact-complex-generatorprocedure

Create an infinite generator that returns objects that fulfill the exact? and complex? predicates. The real and imaginary parts of the complex numbers must be exact. 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 complex numbers. Elements of the above sequence may be omitted if they are not distinguished in the implementation.

If the implementation does not support the exact-complex feature, it is an error to call this procedure.

    (define exact-complex-gen (exact-complex-generator))

    (exact-complex-gen) ; => 0