tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
22
Task/Number-names/PicoLisp/number-names.l
Normal file
22
Task/Number-names/PicoLisp/number-names.l
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
(de numName (N)
|
||||
(cond
|
||||
((=0 N) "zero")
|
||||
((lt0 N) (pack "minus " (numName (- N))))
|
||||
(T (numNm N)) ) )
|
||||
|
||||
(de numNm (N)
|
||||
(cond
|
||||
((=0 N))
|
||||
((> 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 (numNm (% N 10)) "teen"))
|
||||
((> 100 N)
|
||||
(pack
|
||||
(get '("twen" "thir" "for" "fif" "six" "seven" "eigh" "nine") (dec (/ N 10)))
|
||||
"ty"
|
||||
(unless (=0 (% N 10))
|
||||
(pack "-" (numNm (% N 10))) ) ) )
|
||||
((rank N '((100 . "hundred") (1000 . "thousand") (1000000 . "million")))
|
||||
(pack (numNm (/ N (car @))) " " (cdr @) " " (numNm (% N (car @)))) ) ) )
|
||||
Loading…
Add table
Add a link
Reference in a new issue