[plt-scheme] [ANN] Heist: a Scheme interpreter in Ruby

From: James Coglan (jcoglan at googlemail.com)
Date: Tue Aug 4 09:15:43 EDT 2009

2009/8/4 Chongkai Zhu <czhu at cs.utah.edu>

> I just checked both r5rs and r6rs. Their definition of "/simplest/ rational
> number" is more complex than it can be. Here's PLT's (and another system's)
> doc of rationalize:
> ----
> (rationalize x tolerance) ? real?
> x : real?
> tolerance : real?
> Among the real numbers within (abs tolerance) of x, returns the one
> corresponding to an exact number whose denominator is smallest. If multiple
> integers are within tolerance of x, the one closest to 0 is used.
> ----
> rationalize(x,dx)
> yields the rational number with smallest denominator that lies within dx of
> x.
> ----
> in which you can see only to make the denominator smallest is enough. Is
> this enough hint for you to come to an algorithm?

That's certainly enough of a simplification to give me an idea, though I'm
not sure it'll be very efficient. I'll try to implement it and post here for

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090804/e2c29db2/attachment.html>

Posted on the users mailing list.