From 1a68e4e2bef93753a0f9dcf9dd16cdac0c680510 Mon Sep 17 00:00:00 2001 From: Andinus Date: Thu, 22 Jul 2021 15:17:22 +0530 Subject: 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. --- challenge-122/andinus/README | 2 +- challenge-122/andinus/README.org | 2 +- 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); -- cgit