diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2020-10-25 12:01:34 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-25 12:01:34 +0000 |
| commit | df5be3e1dc1b348b4ec7309e0441bfccc2645992 (patch) | |
| tree | 57e7dfe91b9b0cf749997b39e9be51f71ff58d66 | |
| parent | 89421f14095148aefcd254da3d728b6150b22cc3 (diff) | |
| parent | d3dfa7d7291db1d5b92f255ee53f6d4cc8962d8f (diff) | |
| download | perlweeklychallenge-club-df5be3e1dc1b348b4ec7309e0441bfccc2645992.tar.gz perlweeklychallenge-club-df5be3e1dc1b348b4ec7309e0441bfccc2645992.tar.bz2 perlweeklychallenge-club-df5be3e1dc1b348b4ec7309e0441bfccc2645992.zip | |
Merge pull request #2596 from holli-holzer/master
cosmetics
| -rw-r--r-- | challenge-083/markus-holzer/raku/ch-2.raku | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/challenge-083/markus-holzer/raku/ch-2.raku b/challenge-083/markus-holzer/raku/ch-2.raku index 9bc6e3ee33..cac6e2cf7c 100644 --- a/challenge-083/markus-holzer/raku/ch-2.raku +++ b/challenge-083/markus-holzer/raku/ch-2.raku @@ -1,12 +1,11 @@ unit sub MAIN( *@A ); -my &neg = *.grep: * < 0; - -say + neg # find and count all negative numbers of - ( [X] map { +$_, -$_ }, @A ) # all possible candidates - .classify( *.sum ) # grouped by sum - .grep( *.key > -1 ) # filtered where sum is positive - .sort( *.key ) # sorted by sum - .head.value # closest to zero - .min( &neg ) # the one with the least flips +my &less-than-zero = *.grep: * < 0; +say +less-than-zero # find and count all negative numbers of + ( [X] map { +$_, -$_ }, @A ) # all possible candidates + .classify( *.sum ) # grouped by sum + .grep( *.key > -1 ) # filtered where sum is positive + .sort( *.key ) # sorted by sum + .head.value # closest to zero + .min( &less-than-zero ) # the one with the least flips
\ No newline at end of file |
