RosettaCodeData/Task/Nth/Perl-6/nth-2.pl6
2015-02-20 09:02:09 -05:00

5 lines
206 B
Raku

my %irregulars = <1 ˢᵗ 2 ⁿᵈ 3 ʳᵈ>, (11..13 X=> 'ʰ');
sub nth ($n) { $n ~ ( %irregulars{$n % 100} // %irregulars{$n % 10} // 'ʰ' ) }
say .list».&nth for [^26], [250..265], [1000..1025];