diff options
| author | Jan Krňávek <Jan.Krnavek@gmail.com> | 2022-02-14 17:29:50 +0100 |
|---|---|---|
| committer | Jan Krňávek <Jan.Krnavek@gmail.com> | 2022-02-14 17:29:50 +0100 |
| commit | 64cf331a84163d5c55ab51b3791835ad5a541e03 (patch) | |
| tree | 826a98346b595b6d2ca5c70dbbb1c2ff7ed3bba2 | |
| parent | 1ee073463cd0cb1e62525f7eb1e90c0e17e9da12 (diff) | |
| download | perlweeklychallenge-club-64cf331a84163d5c55ab51b3791835ad5a541e03.tar.gz perlweeklychallenge-club-64cf331a84163d5c55ab51b3791835ad5a541e03.tar.bz2 perlweeklychallenge-club-64cf331a84163d5c55ab51b3791835ad5a541e03.zip | |
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; +} |
