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

Re: Integer residue-classes



William D Clinger <will@xxxxxxxxxxx> writes:

> Mike Sperber wrote:
>>
>> - Is there any particular reason for the naming---i.e. why DIV and QUO
>>   are named DIV and QUO and not QUO and DIV?  Do these go back to some
>>   convention?
>
> Not so far as I know.  Egner et al used DIV and MOD, and
> SRFI 77 just copied that paper.  I chose QUO and REM just
> to have different names that parallel DIV and MOD.

OK, so in a sense the naming is ad-hoc.  That's fine, but it is a
problem that the names don't tell you which is which.  At least naming
them DIV+, MOD+ & DIV- and MOD- (or something like that) would give
you a hint.  At this point, the character after the "DIV" is the same
as the sign of the second argument of DIV+MOD in the current SRFI 77
draft, so arguably the current DIV+MOD is slightly more mnemonic than
what you suggest.  The potential for confusion is there, but the
discussion has shown that use of these operations requires significant
care, anyway.  (At least as soon as negative numbers come into play.)

So I can't fault your argument, but I really am not sure which version
(DIV+MOD which switches behavior depending on the second argument, or
separate DIV+MOD and QUO+REM) would be easier to remember or less
confusing.  It would help, if more people on this list could chime in.

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