aboutsummaryrefslogtreecommitdiff
path: root/challenge-075
diff options
context:
space:
mode:
authorSimon Proctor <simon.proctor@zoopla.co.uk>2020-08-25 17:23:40 +0100
committerSimon Proctor <simon.proctor@zoopla.co.uk>2020-08-25 17:23:40 +0100
commit8e487aa6a65d5e05e55bd8d17e819e70d025a7b9 (patch)
tree9518ef136173058ec9b2a8220ef31148109b35a8 /challenge-075
parent1b7b64b0c0918f2a21d58981b435faceb95610c7 (diff)
downloadperlweeklychallenge-club-8e487aa6a65d5e05e55bd8d17e819e70d025a7b9.tar.gz
perlweeklychallenge-club-8e487aa6a65d5e05e55bd8d17e819e70d025a7b9.tar.bz2
perlweeklychallenge-club-8e487aa6a65d5e05e55bd8d17e819e70d025a7b9.zip
Now added a verbose option
Diffstat (limited to 'challenge-075')
-rw-r--r--challenge-075/simon-proctor/raku/ch-1.raku7
1 files changed, 6 insertions, 1 deletions
diff --git a/challenge-075/simon-proctor/raku/ch-1.raku b/challenge-075/simon-proctor/raku/ch-1.raku
index 1ff6b48cfc..f907ee7190 100644
--- a/challenge-075/simon-proctor/raku/ch-1.raku
+++ b/challenge-075/simon-proctor/raku/ch-1.raku
@@ -2,12 +2,17 @@
use v6;
+my %*SUB-MAIN-OPTS = :named-anywhere;
+
#| Given an amount and a list of valid coins show all the combinations of change
sub MAIN (
UInt $amount where * > 0, #= Amount to make change of
*@coins where { .all ~~ Int && .all > 0 }, #= Valid coins
+ Bool :v(:$verbose) = False, #= Print the complete list of combinations
) {
- .join(", ").say for make-change( $amount, @coins );
+ my @change = make-change( $amount, @coins );
+ say @change.elems;
+ if $verbose { .join(", ").say for @change }
}
my %change_cache;