tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
43
Task/Number-names/Joy/number-names.joy
Normal file
43
Task/Number-names/Joy/number-names.joy
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
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.
|
||||
Loading…
Add table
Add a link
Reference in a new issue