Arc Forumnew | comments | leaders | submitlogin
(coerce "99" 'int 16) = 153 ?
1 point by verec 6137 days ago | 3 comments
http://paste.lisp.org/display/55299

From the tutorial:

(coerce "99" 'int 16) => 153

???

Can't fathom how 99 could be written as 153 in any base from 2 to 36 ...



3 points by kennytilton 6137 days ago | link

Try going the other way. 99 in base 16 is (+ (* 9 16) 9)

-----

1 point by sjs 6137 days ago | link

154 is a better example to avoid confusion.

(coerce "9a" 'int 16) => 154

(coerce 154 'string 16) => "9a"

(coerce 154 'string) => "154"

-----

2 points by s3graham 6137 days ago | link

0x99, not 99->hex

-----