[racket-dev] [racket] Question about round

From: David T. Pierson (dtp at mindstory.com)
Date: Sat Oct 1 00:54:59 EDT 2011

Hi all,

I'm hoping that non-developers [of Racket itself] are welcome to post

On Fri, Sep 30, 2011 at 11:59:25AM -0400, Vincent St-Amour wrote:
> Here's a proposal:
> `integer?' becomes the same as `exact-integer?' (which is kept for
> backwards compatibility).

It is not clear to me from the responses to this proposal whether it is
still being considered.  If so I feel motivated to question it.

Quoting the original poster in his follow-up email:

On Fri, Sep 30, 2011 at 09:18:26AM -0700, Mark Engelberg wrote:
> When I saw in the docs for round that it returns an integer, and I was
> getting an inexact number, I was sure it was a mistake.

So the original confusion was due to round returning an inexact? number.
The above proposal does not address that confusion, but instead makes
integer? return #f for inexact? inputs.  So:

  (integer? 1.0) ; would be #f

Are Racket users confused by the current result of (integer? 1.0) => #t?
The original poster explicitly wrote that he expected #t from 
(integer? (round (sin 30))).  It seems to me this proposed change would
increase confusion.

Maybe the concern is that integer? is "unreliable" for inexacts, so the
proposed changes are safer?

As Vincent pointed out in a follow-up email, if (integer? 1.0) should be
#f then (rational? 1.0) should also be #f.  Essentially integer?
becomes useless for inexacts and rational? becomes a synonym for exact?.
The utility of both functions decreases.

It seems to me that the appropriate response to the original confusion
is education/documentation, not a change in the semantics of the
language which decreases utility and breaks backward compatibility.


Posted on the dev mailing list.