[r6rs-discuss] Why are fx+ and fx* restricted to two arguments
William D Clinger
will at ccs.neu.edu
Sun Feb 18 20:04:47 EST 2007
I am posting this as an individual member of the Scheme
community. I am not speaking for the R6RS editors.
Concerning the restriction of fx+ and fx* to exactly two
arguments, Mikael Tillenius wrote:
> I still don't understand why. The programmer must make sure that no
> overflow happens (or be prepared to handle the overflow) independent of
> the number of arguments. Two arguments may overflow as well as ten.
That is a correct statement of the programmer's
responsibility, but consider the implementor's
responsibility to raise an exception if the
result is not expressible as a fixnum, while not
raising an exception if it is.
You may be thinking that (fx+ x y z) would be
equivalent to (fx+ (fx+ x y) z), but that is
not so. For example,
(let ((i (least-fixnum))
(j (greatest-fixnum)))
(list
(fx+ i i i i i i i i i i j j j j j j j j j j)
(fx* i i i i i i i i i 0 i i i i i i i i i)))
would not raise an exception but
(let ((i (least-fixnum))
(j (greatest-fixnum)))
(fx+ i i i i i i i i i i j j j j j j j j j))
would.
Will
More information about the r6rs-discuss
mailing list