diff options
| author | Andinus <andinus@nand.sh> | 2021-07-22 15:17:22 +0530 |
|---|---|---|
| committer | Andinus <andinus@nand.sh> | 2021-07-22 15:17:22 +0530 |
| commit | 1a68e4e2bef93753a0f9dcf9dd16cdac0c680510 (patch) | |
| tree | 299ead6b43df31f90dce918f7e2492e1b0fdd0e3 | |
| parent | 152a1a748f2857a908a3fe08d1416d88508b7d34 (diff) | |
| download | perlweeklychallenge-club-1a68e4e2bef93753a0f9dcf9dd16cdac0c680510.tar.gz perlweeklychallenge-club-1a68e4e2bef93753a0f9dcf9dd16cdac0c680510.tar.bz2 perlweeklychallenge-club-1a68e4e2bef93753a0f9dcf9dd16cdac0c680510.zip | |
Remove unnecessary method calls
``.comb.grep(* !== "").join'' can be replaced with ``.join''.
And we don't have to convert it back to Int since we're just printing
it.
| -rw-r--r-- | challenge-122/andinus/README | 2 | ||||
| -rw-r--r-- | challenge-122/andinus/README.org | 2 | ||||
| -rw-r--r-- | challenge-122/andinus/raku/ch-2.raku | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/challenge-122/andinus/README b/challenge-122/andinus/README index d696f18957..796b1d2086 100644 --- a/challenge-122/andinus/README +++ b/challenge-122/andinus/README @@ -163,7 +163,7 @@ Raku │ │ .put for gather for [X] ((0, 1, 2, 3) xx $score) -> @scores { │ take @scores if ([+] @scores) == $score; - │ }.map(*.grep(* !== 0).comb.grep(* !== "").join).unique.map(*.comb.map(*.Int)); + │ }.map(*.grep(* !== 0).join).unique.map(*.comb); └──── After we gather the lists of scores, remove 0's from there and then we diff --git a/challenge-122/andinus/README.org b/challenge-122/andinus/README.org index dba4aeeb8a..55618223df 100644 --- a/challenge-122/andinus/README.org +++ b/challenge-122/andinus/README.org @@ -139,7 +139,7 @@ unit sub MAIN(Int $score); .put for gather for [X] ((0, 1, 2, 3) xx $score) -> @scores { take @scores if ([+] @scores) == $score; -}.map(*.grep(* !== 0).comb.grep(* !== "").join).unique.map(*.comb.map(*.Int)); +}.map(*.grep(* !== 0).join).unique.map(*.comb); #+end_src After we gather the lists of scores, remove 0's from there and then we diff --git a/challenge-122/andinus/raku/ch-2.raku b/challenge-122/andinus/raku/ch-2.raku index f4ac6cba06..6d18a6b9d9 100644 --- a/challenge-122/andinus/raku/ch-2.raku +++ b/challenge-122/andinus/raku/ch-2.raku @@ -3,4 +3,4 @@ unit sub MAIN(Int $score); .put for gather for [X] ((0,1, 2, 3) xx $score) -> @scores { take @scores if ([+] @scores) == $score; -}.map(*.grep(* !== 0).comb.grep(* !== "").join).unique.map(*.comb.map(*.Int)); +}.map(*.grep(* !== 0).join).unique.map(*.comb); |
