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

Re: [Scheme-reports] Padding/placeholders (hashes) in numerical syntax



On Sun, Sep 04, 2011 at 12:56:59PM -0400, Aaron W. Hsu wrote:
> On Sun, 04 Sep 2011 11:28:46 -0400, Peter Bex <Peter.Bex@x> wrote:
> I have attached the results for Chez Scheme 8.3 (R6RS). I had to make some  
> basic modifications to the prelude, but I also had to change the test in  
> the macro (and res (nan? res) ...) to (and (real? res) (nan? res) ...)  
> because Chez Scheme's NAN? only accepts REAL? values.

You can also just uncomment the definition of nan? at the top, I think.

> > As you can see from the outputs, the "errors" in these Schemes are mostly
> > related to padding syntax, and especially such gems like "#x1#+1#i" or
> > "#e1#/2".  Surprisingly, there's also lots of errors related to allowing
> > the decimal syntax for bases other than 10 (especially in Racket).
> 
> Chez doesn't appear to have any errors related to the padding, but it does  
> exhibit the same flexibility that Racket has regarding these decimal  
> syntaxes.

How does Chez interpret "#x1.3e1"?  Racket says it's 1.242431640625
but 19.0 is equally valid (or even 11.875 if the exponent is taken as 10^n).

The same issue exists in Schemes (like Chicken) which accept other bases
than 2, 8, 10 and 16 for string->number;  "+i" can be either 18+0i or 0+1i
and the other exponent notations s, f, d and l

I think that's why there are only definitions for 10 in the syntax, but I
agree that providing this kind of extension makes some sense.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
							-- Donald Knuth

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports