[plt-dev] Inexact integers

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue May 25 11:01:22 EDT 2010


On May 25, 2010, at 10:48 AM, Sam Tobin-Hochstadt wrote:

> On Tue, May 25, 2010 at 6:49 AM, Shriram Krishnamurthi <sk at cs.brown.edu 
> > wrote:
>> [It sure would be nice to provide a "JavaScript numbers" language
>> level in DrScheme, so people can test under browser numbers and make
>> sure those are sufficient for their programs.  If they are, Moby can
>> generate much simpler and vastly faster code.]
>
> Wouldn't this just be this (untested, not right for keywords,  
> quasiquote):
>
> #lang racket
> (provide (except-out (all-from-out racket) quote #%datum)
>  (rename-out [-#%datum #%datum] [-quote quote]))
> (define-syntax-rule (-#%datum arg) (-quote arg))
> (define-syntax (-quote arg)
>  (syntax-case arg ()
>    [(_ i)
>     (and (number? i) (not (inexact? i)))
>     #'(exact->inexact (quote i))]
>    [(_ i) (quote i)]))
>
> Or maybe just a reader change to read all numbers as inexact?

BSL and ACL2 go the opposite direction: all numbers read as exacts.



Posted on the dev mailing list.