[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Common Lisp solved this problem 20 years ago



Thomas Bushnell BSG wrote:
Per Bothner <per@xxxxxxxxxxx> writes:


Taylor Campbell wrote:

Coercion to integers of a given modulus, for
example, from other integers, is accomplished with a procedure we
already have in R5RS, namely MODULO;

Not the same.  The coercion creates a value with a different run-time
type, such that the generic + operator uses modulo arithmetic.


Can you coerce to fixnum a number which is bigger than maxint, and
reliably get modulus, or would that coercion be an error?

Either is plausible, but I think the former makes more sense.
The Kawa implementation sort-of-does the modulus.  ("Sort-of" because
the implementation currently only handles unboxed "private" Java
numebr types, and their representation/coercion to/from Objects is
incomplete and buggy.)
--
	--Per Bothner
per@xxxxxxxxxxx   http://per.bothner.com/