Re: My ideas about infinity in Scheme (revised) Alef Null Petrofsky 21 May 2005 21:39 UTC

>  | From: "Chongkai Zhu" <xxxxxx@citiz.net>

>  | I have also considered infinities in Scheme and have some
>  | different ideas:
>  |
>  | 1. We need both exact (rational) infinity and inexact infinity,
>  | that is, four special numbers:
>  |
>  | 1/0 -1/0 +inf.0 -inf.0

> From: Aubrey Jaffer <xxxxxx@alum.mit.edu>

> How about "1/0." and "-1/0."?

>  | For the same reason, the syntax of "indeterminate" should be
>  | "0/0" (exact) and "nan.0" (inexact).  The names +inf.0, -inf.0
>  | and nan.0 were borrowed from PLT scheme.
>
> While the number syntax of R5RS can be readily extended to include
> +inf.0, -inf.0 (because of the leading sign). "nan.0" runs afoul of
> R5RS 2.1

Something I'd just like to throw out there is that one can represent
the inexact floating-point entities "NaN" and positive and negative
"infinity" without extending the r5rs BNF at all, by using #i0/0,
#i1/0, and #i-1/0.  (I implemented this for kawa back in 1998, but I
don't know whether kawa still uses that notation.)

I'm dubious about exact infinities (and I'm especially confused by the
idea of Exactly Not A Number, and whether that's the same as Not
Exactly A Number, or if Not Exactly A Number is what NaN has always
meant and therefore the two NaNs would be Inexactly Not Exactly A
Number and Exactly Not Exactly A Number), but I do acknowledge that
exact infinity would make the following behavior implementable and it
would make some sense:

  (let ((never-ending-story (list "and then, ")))
    (set-cdr! never-ending-story never-ending-story)
    (length never-ending-story))
  => 1/0  [exactly]

-al

P.S.  In r5rs, there are many different notations for exact zero:

    0
    -00/42
    #e+.0s7i
    #x0@a

... et cetera.  If we add the quantity Exactly Not Exactly A Number,
does that mean I could start winning friends and influencing people by
using 0@0/0 too?