Number names: Difference between revisions

m
Fix Perl6 -> Raku links and comments
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
m (Fix Perl6 -> Raku links and comments)
Line 5,018:
=={{header|Raku}}==
(formerly Perl 6)
 
Apart from the <tt>$m++</tt> this can be viewed as a purely functional program; we use nested <tt>gather</tt>/<tt>take</tt> constructs to avoid accumulators.
<lang perl6>constant @I = <zero one two three four five six seven eight nine
Line 5,067 ⟶ 5,068:
one hundred ninety eight trillion, seven hundred twenty three billion, four hundred eighty three million, seventeen thousand, four hundred seventeen</pre>
 
Alternately, we could use the [https://modules.raku.org/search/?q=Lingua%3A%3AEN%3A%3ANumbers Lingua::EN::Numbers module from the Perl 6Raku ecosystem]. It will return similar output for similar inputs as above, but also handles fractions with configurable reduction and denominator, exponential notation, and ordinal notation.
 
<lang perl6>use Lingua::EN::Numbers; # Version 2.4.0 or higher
10,327

edits