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

Re: DIGIT-WEIGHT



    Date:  2 October 1980 1407-EDT (Thursday)
    From: Guy.Steele at CMU-10A

    ... Regarding the KMP/JAR proposal:
    (1) I disagree that a separate function DIGIT-WEIGHT is needed;
	DIGITP can return the weight. I don't think confusion of
	novices is likely; what about MEMBER, for example?
The T/() idea is free since there was already a way for people wanting a
number to get it. MEMBER is a fine example, but there was no other existing
way to get the thing MEMBER returns, whereas in our proposal there is.
	The only argument I can think of for a separate function
	DIGIT-WEIGHT is so that it can be declared a FIXNUM function
	in MacLISP; but its range is quite restricted, and the fixnum
	"interning" mechanism will guarantee that no consing is done anyway.
Well, JAR said the same thing and I talked him out of it. The point is that
DIGIT-WEIGHT (in its current one-arg form) is base-independent. ie, 
(DIGIT-WEIGHT #/A) => 10. regardless of base. So if you do (DIGITP #/A) you
go through additional code which checks base. Indeed, you have to do
(DEFUN DIGIT-WEIGHT (X) (DIGITP X 36.)) which is not only slower but amazingly
ugly because it has this random constant 36. is in there.
    (2) Even if there were a DIGIT-WEIGHT function, it also ought to take
	an optional RADIX argument.  (I argue for (DIGITP #/V 'ROMAN) => 5.)
We did have a hairier proposal which did this, but we decided it was too
hairy. I hope you don't take offense but I think ROMAN is (1) cute and (2) a
crock.  Make a PRINT-WITH-ROMAN and/or READ-WITH-ROMAN function if you want.
Include it with the core Lisp system if you really want (though I think it's
unwarranted) but I don't think it deserves a place in the character proposal
unless you make it more general (eg, maybe if ROMAN were bound to some
syntaxtable and you could do (DIGITP #/V ROMAN) ...). I'm not even close to
convinced though.
    (3) The function DIGIT-NAME exists in CHPROP under the name DIGIT-CHAR...
    (4) Minor typos: ...
Oops. Ok.