aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrbaggy <js5@sanger.ac.uk>2022-02-15 13:02:20 +0000
committerdrbaggy <js5@sanger.ac.uk>2022-02-15 13:02:20 +0000
commit5e1b8f19d3e1d29dce68c9b68e1f5757eb8ac3fb (patch)
treec76a81b08d30a7bfc5271fe4e70fe8f5eb639c1f
parentfb0bb43a81c387ae7b22591c531121dc6fcf8337 (diff)
parentc7242a2007a392c923187c6e58d46e54c7715a49 (diff)
downloadperlweeklychallenge-club-5e1b8f19d3e1d29dce68c9b68e1f5757eb8ac3fb.tar.gz
perlweeklychallenge-club-5e1b8f19d3e1d29dce68c9b68e1f5757eb8ac3fb.tar.bz2
perlweeklychallenge-club-5e1b8f19d3e1d29dce68c9b68e1f5757eb8ac3fb.zip
Merge remote-tracking branch 'upstream/master'
vi #
-rw-r--r--challenge-151/wambash/raku/ch-2.raku21
1 files changed, 21 insertions, 0 deletions
diff --git a/challenge-151/wambash/raku/ch-2.raku b/challenge-151/wambash/raku/ch-2.raku
new file mode 100644
index 0000000000..5667a0cee7
--- /dev/null
+++ b/challenge-151/wambash/raku/ch-2.raku
@@ -0,0 +1,21 @@
+#!#!/usr/bin/env raku
+use experimental :cached;
+proto rob-the-house (+@) is cached {*};
+multi rob-the-house (+@ where Empty) {0}
+multi rob-the-house (+@ ($a)) {$a}
+multi rob-the-house(+@ ($h, **@t ($,**@tt))) {
+ rob-the-house(@t) max ($h+rob-the-house(@tt))
+}
+
+multi MAIN (Bool :test($)!) {
+ use Test;
+ is rob-the-house(), 0;
+ is rob-the-house(3),3;
+ is rob-the-house(2, 4, 5), 7;
+ is rob-the-house(4, 2, 3, 6, 5, 3), 13;
+ done-testing;
+}
+
+multi MAIN (*@a) {
+ say rob-the-house @a;
+}