diff options
| author | Simon Proctor <simon.proctor@zoopla.co.uk> | 2020-07-27 09:00:39 +0100 |
|---|---|---|
| committer | Simon Proctor <simon.proctor@zoopla.co.uk> | 2020-07-27 09:00:39 +0100 |
| commit | ae6ac9d417b38f8bcc9cf150e7a5eb2ec7ce43f0 (patch) | |
| tree | 6a1b7f43fea13b2ed1c20aaab99897e9aa76d471 | |
| parent | 6b0fef6d35e61345ad5fd3f2ab5847c0afafc5ff (diff) | |
| download | perlweeklychallenge-club-ae6ac9d417b38f8bcc9cf150e7a5eb2ec7ce43f0.tar.gz perlweeklychallenge-club-ae6ac9d417b38f8bcc9cf150e7a5eb2ec7ce43f0.tar.bz2 perlweeklychallenge-club-ae6ac9d417b38f8bcc9cf150e7a5eb2ec7ce43f0.zip | |
Peaks challenge
| -rw-r--r-- | challenge-071/simon-proctor/raku/ch-1.raku | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/challenge-071/simon-proctor/raku/ch-1.raku b/challenge-071/simon-proctor/raku/ch-1.raku new file mode 100644 index 0000000000..af23f3ea3b --- /dev/null +++ b/challenge-071/simon-proctor/raku/ch-1.raku @@ -0,0 +1,14 @@ +#!/usr/bin/env raku + +use v6; + +# Generate a list of random numbers then find the picks +sub MAIN( + UInt $N where 1 < * <= 50 #= Size of random number list +) { + my @list = (1..50).pick($N); + my @peaks = ( 0, |@list, |0 ).rotor(3 => -2).grep( { $_[0] < $_[1] > $_[2] } ).map( { $_[1] } ); + say "List : {@list.join(',')}"; + say "Peaks : {@peaks.join(',')}"; + +} |
