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] |
> Wow! '-i is a number, while '-a, '-b, 'a, 'b and 'i are symbols. > And someone seriously calls it "good design"?! > What about pi? e? gamma? All of scheme's numbers are a bit of a hack since they use a pseudo infix notation in a non-infix language but they allow just the bare minimum ammount of syntax to make it possible to define numbers without keeping self consistency. All I can say in favour of it is that it works :-( (number? '3/4) => #t (number? '4/3) => #t (number? '0.3) => #t (number? '0.3/4) => #f (number? '3+4i) => #t (number? '3+i4) => #f (number? '4i+3) => #f (number? '3+4) => #f 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. BTW: I also agree that command line processing should be completely done by strings, keep symbols right out of it. 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? Seems to me that good practice is to use (eqv?) as a first choice in most cases and only use (eq?) when there is a good reason to. - Tel