This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home.

Ticket 218: infinity/nan syntax

2011-09-11 07:52:01
WG1 - Reader Syntax
2011-06-07 21:10:16

The current BNF for symbol syntax is rather cumbersome, having to account for the fact that +inf.0, -inf.0 and +nan.0 are numbers even though they do not begin with a numeric prefix.

A simple solution would be to use an alternative such as 0/1, 0/-1 and 0/0, respectively. These are shorter, more self explanatory, and do not conflict with the definition of symbol syntax.

Standardization is not about inventing new stuff unless we have to. Currently:

  • Racket, Gauche, Gambit, Chicken (with some bugs), Guile, Kawa, Chibi, Chez, SCM, Ikarus, Larceny, IronScheme, Ypsilon, Mosh, STklos support the +inf.0, -inf.0, +nan.0 syntaxes.
  • Bigloo prints +Infinity, -Infinity, Infinity on output but treats these as symbols on input.
  • Scheme48 prints #{Inf}, #{-Inf}, #{NaN} but does not accept these syntaxes on input.
  • SISC prints infinity.0, -infinity.0, nan.0 but treats these as symbols on input.
  • SigScheme doesn't do flonums.
  • MIT Scheme, scsh report errors and so needs no such syntax.
  • Scheme 9 reports errors for the infinities and evaluates (/ 0.0 0.0) to 0.0.

In addition, those syntaxes look exact, not inexact. You could fix that with a decimal point, but people would tend to forget where it went (is it 0./1, 0.0/1, 0/1., 0/1.0, some of these, all of these?)


WG1 rejected this proposal.