[plt-scheme] DrScheme Can't Insert Negative Fractions?

From: Grant Rettke (grettke at acm.org)
Date: Sun Aug 31 13:23:37 EDT 2008

On Sun, Aug 31, 2008 at 12:19 PM, Veer <diggerrrrr at gmail.com> wrote:
>> I think "-17 7/9"   means -17 + 7/9  and not -(17 + 7/9) ,  to get the
>
> ok , what i meant was when you enter -17 in whole part and 7 and 9 in
> numerator and
> denominator , then the expression became -17 + 7/9  which is not same as -17 7/9
> and -17 7/9  is indeed -(17 + 7/9) .

Per Carl, and to your point Veer, that is how it works.

#lang scheme
(define whole-s -17)
(define num-s 7)
(define den-s 9)
;; From /collects/drscheme/private/unit.ss line 279
(let ([ans (+ whole-s (/ num-s den-s))])
  (if (and (exact? ans)
           (real? ans)
           (not (integer? ans)))
      ans
      #f))

Not what I expected! Thanks for listening (and answering) guys!


Posted on the users mailing list.