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

Re: Ooops, forgot to send this to LISP-FORUM

- - - - Begin forwarded message - - - -
Date:  3 October 1980 1112-EDT (Friday)
From: Guy.Steele at CMU-10A
To: KMP at MIT-MC (Kent M. Pitman)
Subject:  Re: Why DIGITP and DIGIT-WEIGHT?

Well, first of all you make the implicit assumption that the weight
of a digit is independent of the radix.  That may be true in most
practical applications, but I would like to avoid it if possible,
for the sake of (perhaps imaginary) future flexibility.  Second,
the most common case is in fact to test for digitness and then,
if it is a digit, do something with the weight.  Both routines
do about the same thing, after all--the motivation for having only
one is similar (though on a smaller scale) to the desire for a
DIVIDE function (say--why haven't we got one??) that returns both
quotient and remainder, because doing it twice can be expensive on
I do agree with your arguments about DIGITP being used "out of the blue"
just to get the weight without testing.  I might argue that for robustness
one ought to check the result to make sure it's not (), but then again,
I suppose I would be happy to have only a single function, but have
it called DIGIT-WEIGHT rather than DIGITP.  If you don't like the
looks of (COND ((DIGIT-WEIGHT ...) ...) ...), then how about CHAR-DIGIT,
by symmetry with DIGIT-CHAR?
- - - - End forwarded message