[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
reading numbers as symbols
Perhaps I should have been clearer the first go round. I got several
responses to my question about reading potnums as symbols like this:
Wouldn't it work to do the read with a readtable where all the numbers
were given the same syntax class as alphabetic characters?
The answer is no. Digits ARE alphabetic characters -- their interpretation
as numbers depends only on the radix (*read-base*) value. So
<cl> (set-syntax-from-char #\1 #\A)
T
<cl> (set-syntax-from-char #\0 #\A)
T
<cl> (read-from-string "00001")
1
5
<cl> (read-from-string "0000A")
0000A
5
<cl> (let ((*read-base* 16)) (read-from-string "0000A"))
10
5
<cl>