tasks a-s

This commit is contained in:
Ingy döt Net 2013-04-10 23:57:08 -07:00
parent 47bf37c096
commit b83f433714
12433 changed files with 156208 additions and 123 deletions

View file

@ -0,0 +1,22 @@
(de numToString (N Base)
(default Base 10)
(let L NIL
(loop
(let C (% N Base)
(and (> C 9) (inc 'C 39))
(push 'L (char (+ C `(char "0")))) )
(T (=0 (setq N (/ N Base)))) )
(pack L) ) )
(de stringToNum (S Base)
(default Base 10)
(let N 0
(for C (chop S)
(when (> (setq C (- (char C) `(char "0"))) 9)
(dec 'C 39) )
(setq N (+ C (* N Base))) )
N ) )
(prinl (numToString 26 16))
(prinl (stringToNum "1a" 16))
(prinl (numToString 123456789012345678901234567890 36))