chickadee » srfi-252 » inexact-rational-generator

inexact-rational-generatorprocedure

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

    0.0 -0.0 0.5 -0.5 1.0 -1.0

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

    (define inexact-rational-gen (inexact-rational-generator))

    (inexact-rational-gen) ; => 0.0