Four is magic: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added a caveat to the REXX section header (concerning the maximum number supported).) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: minor grammar & style tweaks) |
||
Line 39: | Line 39: | ||
:* You are encouraged, though not mandated to use proper sentence capitalization. |
:* You are encouraged, though not mandated to use proper sentence capitalization. |
||
:* You may optionally support negative numbers. '''-7''' is '''negative seven'''. |
:* You may optionally support negative numbers. '''-7''' is '''negative seven'''. |
||
:* Show the output here for a small representative sample of values, at least 5 but no more than 25. You are free to |
:* Show the output here for a small representative sample of values, at least 5 but no more than 25. You are free to choose which which numbers to use for output demonstration. |
||
You can choose to use a library, (module, external routine, whatever) to do the cardinal conversions as long as the code is easily and freely available to the public. |
You can choose to use a library, (module, external routine, whatever) to do the cardinal conversions as long as the code is easily and freely available to the public. |
||
Line 193: | Line 193: | ||
=={{header|Perl 6}}== |
=={{header|Perl 6}}== |
||
{{works with|Rakudo|2017.09}} |
{{works with|Rakudo|2017.09}} |
||
Lingua::EN::Numbers::Cardinal module available from the |
Lingua::EN::Numbers::Cardinal module available from the [https://modules.perl6.org/search/?q=Lingua%3A%3AEN%3A%3ANumbers%3A%3ACardinal Perl 6 ecosystem]. |
||
<lang perl6>use Lingua::EN::Numbers::Cardinal; |
<lang perl6>use Lingua::EN::Numbers::Cardinal; |
||
Line 204: | Line 204: | ||
$string ~= "{ card($int) } is "; |
$string ~= "{ card($int) } is "; |
||
if $int = ($int == 4) ?? 0 !! card($int).chars { |
if $int = ($int == 4) ?? 0 !! card($int).chars { |
||
$string ~= "{ card($int) }, " |
$string ~= "{ card($int) }, " |
||
} else { |
} else { |
||
$string ~= "magic.\n"; |
$string ~= "magic.\n"; |
||
last |
last |
||
} |
} |
||
} |
} |
||
$string.tc |
$string.tc |
||
} |
} |
||
.&magic.say for 0, 4, 6, 11, 13, 75, 337, -164, 9876543209, 2**256;</lang> |
.&magic.say for 0, 4, 6, 11, 13, 75, 337, -164, 9876543209, 2**256;</lang> |