Counting adventure by yshl

[/f{/four/fif}/s{/six/seven/eigh/nine}/t{/ten/eleven}>>begin[/n[/first/second/third
f s pop/nin t/twelf]/m[/one/two/three f pop/five s exch pop/eight exch
t/twelve]/p{( positive integer is )print}/o{=only}/h{(th)print}>>begin 1 1
.runstdin{(The )print dup 12 le{1 sub n 1 index get o dup 3 ge{h}if p m exch
get}{dup 20 lt{[/thir f s]1 index 13 sub get dup o(teenth)print p o(teen)}{dup
100 eq{(one hundred)dup print h p}{[/twen/thir/for/fif s]1 index 10 idiv 2 sub
get dup o 1 index 10 mod 0 eq{(tieth)print p o(ty)}{(ty-)print n 2 index 10 mod
1 sub get o 1 index 10 mod 4 ge{h}if p o(ty-)print m exch 10 mod 1 sub
get}ifelse}ifelse}ifelse}ifelse o(.)=}for

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page