P95
(de fullWords (N) (cond ((=0 N) "zero") ((> 14 N) (get '("one" "two" "three" "four" "five" "six" "seven" "eight" "nine" "ten" "eleven" "twelve" "thirteen") N ) ) ((= 15 N) "fifteen") ((= 18 N) "eighteen") ((> 20 N) (pack (fullWords (% N 10)) "teen")) ((> 100 N) (pack (get '("twen" "thir" "for" "fif" "six" "seven" "eigh" "nine") (dec (/ N 10)) ) "ty" (unless (=0 (% N 10)) (pack "-" (fullWords (% N 10))) ) ) ) ((rank N '((100 . "hundred") (1000 . "thousand") (1000000 . "million"))) (pack (fullWords (/ N (car @))) " " (cdr @) " " (fullWords (% N (car @)))) ) ) )
http://picolisp.com/wiki/?99p95
11jul10 | abu |