diff options
| author | Mark <53903062+andemark@users.noreply.github.com> | 2024-01-15 23:24:08 +0000 |
|---|---|---|
| committer | Mark <53903062+andemark@users.noreply.github.com> | 2024-01-15 23:24:08 +0000 |
| commit | daf52938c1e04b3edc829a3d12e1aafd51742c34 (patch) | |
| tree | d6136447aa11e55da1b3c716ea4defc71fc0b408 | |
| parent | 10d7dc1c81d1299bee405a2059f72c85f8c9b9eb (diff) | |
| download | perlweeklychallenge-club-daf52938c1e04b3edc829a3d12e1aafd51742c34.tar.gz perlweeklychallenge-club-daf52938c1e04b3edc829a3d12e1aafd51742c34.tar.bz2 perlweeklychallenge-club-daf52938c1e04b3edc829a3d12e1aafd51742c34.zip | |
Challenge 252 Solutions (Raku)
| -rw-r--r-- | challenge-252/mark-anderson/raku/ch-2.raku | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/challenge-252/mark-anderson/raku/ch-2.raku b/challenge-252/mark-anderson/raku/ch-2.raku index 873a46dbdd..3e398a8e1e 100644 --- a/challenge-252/mark-anderson/raku/ch-2.raku +++ b/challenge-252/mark-anderson/raku/ch-2.raku @@ -3,14 +3,13 @@ use Test; is-deeply uniq-sum-zero(5), (-2,-1,1,2,0); is-deeply uniq-sum-zero(3), (-1,1,0); +is-deeply uniq-sum-zero(2), (-1,1); is-deeply uniq-sum-zero(1), (0,); is-deeply uniq-sum-zero(0), (); is-deeply uniq-sum-zero(8), (-4,-3,-2,-1,1,2,3,4); is-deeply uniq-sum-zero(9), (-4,-3,-2,-1,1,2,3,4,0); -multi uniq-sum-zero($n where 0) { () } -multi uniq-sum-zero($n where 1) { (0,) } -multi uniq-sum-zero($n where * > 1) +sub uniq-sum-zero($n) { my $i = $n div 2; (-$i...-1,1,2,3...$i,0)[^$n] |
