diff options
| author | Mark <53903062+andemark@users.noreply.github.com> | 2024-03-18 16:38:08 +0000 |
|---|---|---|
| committer | Mark <53903062+andemark@users.noreply.github.com> | 2024-03-18 16:38:08 +0000 |
| commit | 3f1e8ce748cd9e440d7741ee9c032c55a74467fc (patch) | |
| tree | 4e7eaf4cbc3b42d1a60ebeb5078664e00d0596af | |
| parent | 1284596f93434a7747874691e0734fccc968e425 (diff) | |
| download | perlweeklychallenge-club-3f1e8ce748cd9e440d7741ee9c032c55a74467fc.tar.gz perlweeklychallenge-club-3f1e8ce748cd9e440d7741ee9c032c55a74467fc.tar.bz2 perlweeklychallenge-club-3f1e8ce748cd9e440d7741ee9c032c55a74467fc.zip | |
Challenge 261 Solutions (Raku)
| -rw-r--r-- | challenge-261/mark-anderson/raku/ch-2.raku | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/challenge-261/mark-anderson/raku/ch-2.raku b/challenge-261/mark-anderson/raku/ch-2.raku index 4f453b02d7..8254214c62 100644 --- a/challenge-261/mark-anderson/raku/ch-2.raku +++ b/challenge-261/mark-anderson/raku/ch-2.raku @@ -5,5 +5,6 @@ is multiply-by-two([5,3,6,1,12], 3), 24; is multiply-by-two([1,2,4,3], 1), 8; is multiply-by-two([5,6,7], 2), 2; -multi multiply-by-two(@i, $s) { return $s } -multi multiply-by-two(@i, $s where $s (elem) @i) { samewith(@i, $s * 2) } +multi multiply-by-two(@i, $s) { samewith(@i.BagHash, $s) } +multi multiply-by-two($b, $s) { return $s } +multi multiply-by-two($b, $s where ?$b{$s}) { $b{(0..$s)}:delete; samewith($b, $s*2) } |
