aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus "Holli" Holzer <holli.holzer@gmail.com>2020-09-21 16:16:39 +0200
committerMarkus "Holli" Holzer <holli.holzer@gmail.com>2020-09-21 16:16:39 +0200
commit4968031a8c17661761edfb6d94fef6bd3169722c (patch)
treeb6bb471070be68b2aa4b372a270b13b22865d6ef
parentda89e65b16be36928445f92d5443dfd6801c76f2 (diff)
downloadperlweeklychallenge-club-4968031a8c17661761edfb6d94fef6bd3169722c.tar.gz
perlweeklychallenge-club-4968031a8c17661761edfb6d94fef6bd3169722c.tar.bz2
perlweeklychallenge-club-4968031a8c17661761edfb6d94fef6bd3169722c.zip
nicer
-rw-r--r--challenge-079/markus-holzer/raku/ch-2.raku8
1 files changed, 4 insertions, 4 deletions
diff --git a/challenge-079/markus-holzer/raku/ch-2.raku b/challenge-079/markus-holzer/raku/ch-2.raku
index 864734a511..532d2505a3 100644
--- a/challenge-079/markus-holzer/raku/ch-2.raku
+++ b/challenge-079/markus-holzer/raku/ch-2.raku
@@ -1,10 +1,10 @@
unit sub MAIN( *@N where @N.all ~~ Int );
-sub index-height { @N.pairs.grep( *.value >= $^height ).map: *.key }
-sub index-diff { $^indexes.map({ .[1] - .[0] - 1 if .elems }).sum }
+sub index-find { @N.pairs.grep( *.value >= $^h ).map: *.key }
+sub index-diff { ($^i.cache.skip >>->> $^i).map: * - 1 }
say (@N.max...0)
- .map( &index-height )
- .map( *.rotor: 2 => -1 )
+ .map( &index-find )
.map( &index-diff )
+ .flat
.sum; \ No newline at end of file