guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] First batch of numerics changes


From: Mark H Weaver
Subject: Re: [PATCH] First batch of numerics changes
Date: Fri, 28 Jan 2011 19:05:35 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Andy Wingo <address@hidden> writes:
> I think that certainly when it comes to numbers, strictness is good.  In
> particular the r6rs says:
>
>     (zero? z)     procedure
>     (positive? x) procedure
>     (negative? x) procedure
>     (odd? n)      procedure
>     (even? n)     procedure
>     (finite? x)   procedure
>     (infinite? x) procedure
>     (nan? x)      procedure
>
> The name of the argument indicates the type, as noted earlier in the
> report.  `z' is a complex number, `x' is a real, and `n' is an integer.
> It is an error to pass a non-integer to even?.  It is also an error to
> pass a non-real to infinite?.

Are you reading the final version of R6RS, or a draft?  The above
paragraph is not present at:

  http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-14.html

Instead, there is this paragraph:

> These numerical predicates test a number object for a particular
> property, returning #t or #f. The zero? procedure tests if the number
> object is = to zero, positive? tests whether it is greater than zero,
> negative? tests whether it is less than zero, odd? tests whether it is
> odd, even? tests whether it is even, finite? tests whether it is not
> an infinity and not a NaN, infinite? tests whether it is an infinity,
> nan? tests whether it is a NaN.

I interpreted the above text to mean that those predicates could be
applied to any number object.  Can you find anywhere in the final R6RS
where it states that the variable names indicate the domain of those
predicates?

> (Note that the domain of first 5 predicates is specified in R5RS as
> well.)

That is certainly true.  Thanks for pointing that out, I had forgotten
that the formal variable names were significant.  I agree with the
domains of the first 5 predicates as specified in R5RS.

However, I strongly believe that finite?, infinite?, and nan? should be
applicable to non-real complex numbers.  They would clearly be useful as
such, otherwise those working with complex numbers will have to
reimplement them.

Can you show me some text from R6RS Final that explicitly states that
those formal variable names indicate the domain?

    Mark



reply via email to

[Prev in Thread] Current Thread [Next in Thread]