NYSIIS: Difference between revisions

40 bytes added ,  6 years ago
m
→‎{{header|Perl 6}}: explicit return of modified variable
(→‎{{header|Racket}}: actual implementation added)
m (→‎{{header|Perl 6}}: explicit return of modified variable)
Line 417:
 
=={{header|Perl 6}}==
{{Works with|rakudo|2017.05}}
This implementation removes common name suffixes similar to the reference implementation, even though it is not specified in the task description or on the linked [[wp:New York State Identification and Intelligence System|NYSIIS]] page. This algorithm isn't too friendly to certain French kings. :)
 
Line 445 ⟶ 446:
s:c(1):g/H(<-[AEIOU]>)/$0/;
s:g/(<-[AEIOU]>)H/$0/;
s:g/(<-[AEIOU]>.)W/$0/;
s/ AY$ /Y/;
s/ S$ //;
Line 451 ⟶ 452:
s:g/ (.)$0+ /$0/;
}
return $name;
}
 
2,392

edits