Number names: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
Thundergnat (talk | contribs) m (Fix Perl6 -> Raku links and comments) |
||
Line 5,018: | Line 5,018: | ||
=={{header|Raku}}== |
=={{header|Raku}}== |
||
(formerly Perl 6) |
(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. |
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 |
<lang perl6>constant @I = <zero one two three four five six seven eight nine |
||
Line 5,067: | Line 5,068: | ||
one hundred ninety eight trillion, seven hundred twenty three billion, four hundred eighty three million, seventeen thousand, four hundred seventeen</pre> |
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 Lingua::EN::Numbers module from the |
Alternately, we could use the [https://modules.raku.org/search/?q=Lingua%3A%3AEN%3A%3ANumbers Lingua::EN::Numbers module from the Raku 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 |
<lang perl6>use Lingua::EN::Numbers; # Version 2.4.0 or higher |