[R6RS] Division and remainder

Michael Sperber sperber at informatik.uni-tuebingen.de
Sun Apr 2 12:31:49 EDT 2006

This is mainly for Will, but feel free to jump in.

I like the characterization on


as a basis for the division and remainder operators.  Pretty much
everybody was in favor of having two sets.  I also agree that we
should make division by 0 an exception.

I have trouble with the names: Using different words as the basis for
the different residue classes with no mnemonic association seems
pretty arbitrary.  Worse, it seems everybody seems to have their own
intuition about what "division" and "remainder" should be.  (Someone
noted that Haskell also has two sets, but none corresponds to anyone
proposed above.)

How about

div+ / mod+ for what's `div' and 'mod' above
div2 / mod2 for what's `quo' and `rem' above (because of the
  association with two's complement)


Of course, I'd be happy to pick better names, should anyone come up
with a good set.

As a bonus, we might keep `quotient' and `remainder' from R5RS with a
more palatable definition along your characterization, to satisfy Brad
Lucier, and to match, for instance, `quot' and `rem' in Haskell.
(Even though I suspect Haskell copied them from Scheme.)

[Having `div2' and `mod2' also alleviates the need for fixnum
operations with parameterized width---they're really easy to define
using these.]

Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla

More information about the R6RS mailing list