[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why DIGITP and DIGIT-WEIGHT?
- Subject: Re: Why DIGITP and DIGIT-WEIGHT?
- From: Glenn S. Burke <GSB at MIT-ML>
- Date: Thu ,2 Oct 80 18:35:00 EDT
I would like to be able to say (DIGITP ch) and not lose efficiency over
doing (LESSP #.(1- #/0) ch #.(1+ #/9)) (assuming "primitive" maclisp).
For that reason, i think it is appropriate for DIGITP to barf if its
arg is not a "character". For the same reason, it is reasonable for
DIGIT-WEIGHT to admit a second argument. One could argue that the
optional second arguments to the two functions should default similarly,
but i don't think that is necessarily reasonable given the differing
meanings. But the whole point, at least in my view, is that there
should be some routines available so i don't have to know the magic
constants in converting digits <-> integers (and alphabetic case etc.),
assuming even that there are any. One could envision the sequence
(char in TT)
ANDI TT,137
CAILE TT,31
SUBI TT,47
SUBI TT,20
as an open-coding for (DIGIT-WEIGHT c), allowing a radix of 36. If it
is a predicate also you tend to lose the ability to do things like this.