diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2022-02-15 11:44:36 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-15 11:44:36 +0000 |
| commit | c7242a2007a392c923187c6e58d46e54c7715a49 (patch) | |
| tree | dfc79bf2944ddec3951f72d5a8423fc79eddeff3 | |
| parent | 83a60a3be16f74882801abfea7f376f320db2a5e (diff) | |
| parent | 64cf331a84163d5c55ab51b3791835ad5a541e03 (diff) | |
| download | perlweeklychallenge-club-c7242a2007a392c923187c6e58d46e54c7715a49.tar.gz perlweeklychallenge-club-c7242a2007a392c923187c6e58d46e54c7715a49.tar.bz2 perlweeklychallenge-club-c7242a2007a392c923187c6e58d46e54c7715a49.zip | |
Merge pull request #5657 from wambash/challenge-week-151
solution week 151
| -rw-r--r-- | challenge-151/wambash/raku/ch-2.raku | 21 |
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; +} |
