Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • \$\begingroup\$ Saves a byte to use a whatevercode block: *.comb(/\d+/).sum \$\endgroup\$
    – naffetS
    Commented Nov 29, 2022 at 2:59
  • \$\begingroup\$ @Steffan I believe that may have been before the .sum method was added to the language. Which if I recall correctly would make it unavailable according to the rules. \$\endgroup\$ Commented Dec 1, 2022 at 2:19
  • \$\begingroup\$ That rule has changed since, you can now use languages newer than the challenge. I didn't know that Raku never had a sum method though \$\endgroup\$
    – naffetS
    Commented Dec 1, 2022 at 4:23
  • 1
    \$\begingroup\$ @Steffan. Originally Raku did not have sum of any sort. Partially because sum(1..5) could be written using the reduce meta operator [+](1..5). At some point it became obvious that there could be an optimization if the input was a range. A range could calculate its sum without going over its contents. So now the meta operator [+]... gets converted to sum which will allow for this optimization to take place. Basically the only reason sum was added is as an optimization. github.com/rakudo/rakudo/commit/… \$\endgroup\$ Commented Jan 11, 2023 at 0:46