diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2020-08-25 21:37:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-25 21:37:40 +0100 |
| commit | 58feb48fa8a3c6291d693b7a0f114f46eb9c36aa (patch) | |
| tree | 3291af2b92a4ab25f493639a82bbc6684e751b44 | |
| parent | e0f3a43ad8fa53bcd660167d252acb34a7ab9976 (diff) | |
| parent | 8e487aa6a65d5e05e55bd8d17e819e70d025a7b9 (diff) | |
| download | perlweeklychallenge-club-58feb48fa8a3c6291d693b7a0f114f46eb9c36aa.tar.gz perlweeklychallenge-club-58feb48fa8a3c6291d693b7a0f114f46eb9c36aa.tar.bz2 perlweeklychallenge-club-58feb48fa8a3c6291d693b7a0f114f46eb9c36aa.zip | |
Merge pull request #2145 from Scimon/master
Now added a verbose option
| -rw-r--r-- | challenge-075/simon-proctor/raku/ch-1.raku | 7 |
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; |
