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

# in place of a digit.




A friend of mine posed the following question:

Without testing it on a Scheme implementation, what does '18#' refer
to, and where in R4RS is this explained clearly?

My first reaction was that it should be the same as 180.0, which is
clearly one possible correct answer, c.f. the example after
string->number; the question is whether or not this is the only
possible correct answer.  I wanted it to be the same as 180.0 because
I thought that, say, 1.0 should mean the same as 1.0#.  However,
Scheme 48 returns 185.0 if you type in 18#, and that is sensible
behaviour as well.

So what was the intent here?  Is Scheme 48's return value one correct
possibility?  If so, the standard should certainly clarify matters.
(For example, would the allowable range be anything >= 180 and < 190,
or would it be >= 175 and <= 185?)  Or is 180.0 the only correct
return value?  If so, I think the standard should either clarify
matters or just get rid of the #-in-place-of-digit syntax entirely,
since people can just as easily type 0's, and the numerics section is
already complicated enough as it is.  In either case, has anybody ever
used this syntax?

david carlton
carlton@math.mit.edu