Abbreviations, automatic: Difference between revisions
m
→{{header|Perl 6}}: Follow Haskell example; generalize to work with any arbitrary list of words. (remove hard coded size of 7)
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: Follow Haskell example; generalize to work with any arbitrary list of words. (remove hard coded size of 7)) |
|||
Line 446:
<lang perl6>sub auto-abbreviate ( Str $string ) {
return Nil unless my @
my $max = @
for 0 .. $max {
return $_
return '∞' if $_ == $max;
}
|