43 lines
766 B
Text
43 lines
766 B
Text
DEFINE units ==
|
|
["zero" "one" "two" "three" "four" "five" "six" "seven" "eight" "nine" "ten"
|
|
"eleven" "twelve" "thirteen" "fourteen" "fifteen" "sixteen" "seventeen"
|
|
"eighteen" "nineteen"];
|
|
|
|
tens ==
|
|
["ten" "twenty" "thirty" "forty" "fifty" "sixty" "seventy" "eighty" "ninety"];
|
|
|
|
convert6 ==
|
|
[1000000 <]
|
|
[1000 div swap convert " thousand " putchars convert3]
|
|
[1000000 div swap convert " million " putchars convert3]
|
|
ifte;
|
|
|
|
convert5 ==
|
|
[null]
|
|
[]
|
|
[" and " putchars convert]
|
|
ifte;
|
|
|
|
convert4 ==
|
|
[1000 <]
|
|
[100 div swap units of putchars " hundred" putchars convert5]
|
|
[convert6]
|
|
ifte;
|
|
|
|
convert3 ==
|
|
[null]
|
|
[]
|
|
[32 putch convert]
|
|
ifte;
|
|
|
|
convert2 ==
|
|
[100 <]
|
|
[10 div swap pred tens of putchars convert3]
|
|
[convert4]
|
|
ifte;
|
|
|
|
convert ==
|
|
[20 <]
|
|
[units of putchars]
|
|
[convert2]
|
|
ifte.
|