N'th: Difference between revisions
m
... and moved Quackery into correct place. I do know the alphabet, honestly.
(Added Quackery.) |
m (... and moved Quackery into correct place. I do know the alphabet, honestly.) |
||
Line 2,723:
1022nd 1023rd 1024th 1025th
</pre>
=={{header|Quackery}}==▼
<lang Quackery> [ table ] is suffix ( n --> $ )▼
$ "th st nd rd th th th th th th"▼
nest$ witheach [ ' suffix put ]▼
[ dup number$ ▼
swap dup 100 mod ▼
10 21 within iff▼
[ drop $ "th" join ]▼
else▼
[ 10 mod ▼
suffix join ] ] is ordinal$ ( n --> $ )▼
[ over - 1+▼
[] swap times ▼
[ over i^ + ordinal$ ▼
nested join ]▼
nip 50 wrap$ ] is test ( n n --> )▼
0 25 test ▼
cr▼
250 265 test▼
cr▼
1000 1025 test</lang>▼
{{out}}▼
<pre>0th 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th▼
12th 13th 14th 15th 16th 17th 18th 19th 20th 21st▼
22nd 23rd 24th 25th▼
250th 251st 252nd 253rd 254th 255th 256th 257th▼
258th 259th 260th 261st 262nd 263rd 264th 265th▼
1000th 1001st 1002nd 1003rd 1004th 1005th 1006th▼
1007th 1008th 1009th 1010th 1011th 1012th 1013th▼
1014th 1015th 1016th 1017th 1018th 1019th 1020th▼
1021st 1022nd 1023rd 1024th 1025th</pre>▼
=={{header|R}}==
Line 2,774 ⟶ 2,815:
[26,] "25'th" "275'th" "525'th" "775'th" "1025'th"
</pre>
▲=={{header|Quackery}}==
▲<lang Quackery> [ table ] is suffix ( n --> $ )
▲ $ "th st nd rd th th th th th th"
▲ nest$ witheach [ ' suffix put ]
▲ [ dup number$
▲ swap dup 100 mod
▲ 10 21 within iff
▲ [ drop $ "th" join ]
▲ else
▲ [ 10 mod
▲ suffix join ] ] is ordinal$ ( n --> $ )
▲ [ over - 1+
▲ [] swap times
▲ [ over i^ + ordinal$
▲ nested join ]
▲ nip 50 wrap$ ] is test ( n n --> )
▲ 0 25 test
▲ cr
▲ 250 265 test
▲ cr
▲ 1000 1025 test</lang>
▲{{out}}
▲<pre>0th 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th
▲12th 13th 14th 15th 16th 17th 18th 19th 20th 21st
▲22nd 23rd 24th 25th
▲250th 251st 252nd 253rd 254th 255th 256th 257th
▲258th 259th 260th 261st 262nd 263rd 264th 265th
▲1000th 1001st 1002nd 1003rd 1004th 1005th 1006th
▲1007th 1008th 1009th 1010th 1011th 1012th 1013th
▲1014th 1015th 1016th 1017th 1018th 1019th 1020th
▲1021st 1022nd 1023rd 1024th 1025th</pre>
=={{header|Racket}}==
|