Timeline for Filter out and add up
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 11, 2023 at 0:46 | comment | added | Brad Gilbert b2gills |
@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/…
|
|
Dec 1, 2022 at 4:23 | comment | added | naffetS | 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 | |
Dec 1, 2022 at 2:19 | comment | added | Brad Gilbert b2gills |
@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.
|
|
Nov 29, 2022 at 2:59 | comment | added | naffetS |
Saves a byte to use a whatevercode block: *.comb(/\d+/).sum
|
|
Feb 12, 2016 at 23:14 | history | edited | Brad Gilbert b2gills | CC BY-SA 3.0 |
Added alternative that uses split instead
|
Feb 12, 2016 at 18:23 | history | answered | Brad Gilbert b2gills | CC BY-SA 3.0 |