Bradley Lucier <xxxxxx@purdue.edu> writes:
> On 1/14/24 2:04 PM, Antero Mejr (via srfi-252 list) wrote:
>
> Perhaps the generators should correspond to
>
> exact-integer (and (exact? x) (integer? x))
> exact-positive-integer (and (exact? x) (integer? x) (positive? x))
> exact-rational (and (exact? x) (rational? x))
> exact-real usually the same as exact-rational
> exact-integer-complex (and (exact? x) (integer? (real-part x)) (integer?
> (imag-part x))
> exact-complex (and (exact? x) (complex? x))
> exact-number usually the same as exact-complex
>
> exact-positive-integer can help generate exact-rational. exact-integer-complex
> is useful for some number theory tasks.
>
> inexact-integer (and (inexact? x) (integer? x))
> inexact-rational (and (inexact? x) (rational? x)) ;; finite
> inexact-real inexact-rational + infinities + nan
> inexact-complex (and (inexact? x) (complex? x))
> inexact-number usually the same as inexact-complex
>
> then the union of inexact and exact:
>
> integer
> rational
> real
> complex
> number
I redid the numerical generators today, the ones I ended up with are:
exact-complex-generator exact-integer-generator
exact-number-generator exact-rational-generator
exact-real-generator
exact-integer-complex-generator
inexact-complex-generator inexact-integer-generator
inexact-number-generator inexact-rational-generator
inexact-real-generator
complex-generator integer-generator
number-generator rational-generator
real-generator
That includes all your suggestions except exact-positive-integer.
For that case I think the user should make custom generator like this:
(gfilter positive? (exact-integer-generator))
Not all implementations have exact-complex, but this SRFI provides
exact-complex-generator and exact-integer-complex-generator. I specified
that if an implementation does not have exact-complex and the user calls
those procedures, it must raise an error. Not sure if that is the ideal
way to manage it.