This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Things I like about numbers (Re: Serious eq? bug?)



telford@triangle.triode.net.au writes:
> Still, you have to set the standard somewhere. Possibly
> it would be nice to have an option to generate warnings about
> numbers that look a bit too simiar to symbols (e.g. '-i)
> and symbols that look a bit too similar to numbers (e.g. '4i+3),
> maybe it is just a matter of getting familiar with the
> tricks and traps of the language.
> 

Actually, the standard says that identifiers cannot begin with a
character that can begin a number, but obviously Guile has extended
the range of allowed identifiers.

> BTW: I also agree that command line processing should be
> completely done by strings, keep symbols right out of it.
> 

Well, if anyone still wants to use a symbol, in Guile you can
represent the symbol withthe name -i with '#{-i}#.

> On the issue of (eq?), I find it strange that R4RS deliberately
> says that using (eq?) between two numbers produces an unspecified
> result depending in implementation. At least guile is in line
> with the standard there because two integers are correctly
> compared by (eq?) but two identical floats are not. I don't follow
> the note that it may not be possible to compare two numbers in
> finite time... does scheme support numerical formats that I
> don't understand?
> 

The goal is for eq? to be computable in constant time, I think. In
particular, it's supposed to be easy to implement it as a simple
pointer comparison. Note that Guile is therefore only likely to be
able to compare small integers with eq? successfully.

 - Maciej