[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bawden's remarks on characters
- Subject: Re: Bawden's remarks on characters
- From: Guy.Steele at CMU-10A
- Date: Fri ,15 Aug 80 17:39:00 EDT
While character *objects* as an explicit data type may be a loss
(I don't think so, but only marginally), the *idea* of characters
is certainly a distinct idea from that of fixnums. If you disagree,
then I claim that the difference between characters and fixnums
is not very different from that between fixnums and flonums -- they are
both bit patterns, right? -- indeed, Gosper and Kahan get a lot of
mileage out of doing ADD and TLNE instead of FADD on flonums --
so maybe we should just go back to assembly language.
Sure, you can add 7 to #/0 to get #/7. You can also subtract a
constant to convert to upper case. But which constant? For ASCII,
it is 32 decimal. For EBCDIC, it is -64 decimal (in EBCDIC, lower-case
letters have smaller numeric codes than upper case ones). Does this
constant work for Greek fonts?
Yes, adding 23. to #/A to get #/X is a neat crock. So is Kahan's
SQRT algorithm. The latter is somewhat contained, however, while
the former is, I suggest, too much more pervasive. Writing
(CODE-CHAR (+ 23. (CODE-CHAR #/A))) is not that much more work,
is clearer as to what is going on, and no less efficient when
compiled (on the LISP Machine CODE-CHAR and CHAR-CODE are probably
identity macros -- but by putting in the calls to identify the explicit
coercions we give the code half a chance of being compatible witrh
other implementations).