diff options
| author | Scimon Proctor <simon.proctor@gmail.com> | 2021-07-19 09:56:06 +0100 |
|---|---|---|
| committer | Scimon Proctor <simon.proctor@gmail.com> | 2021-07-19 09:56:06 +0100 |
| commit | ecb612591c012ba4de6480192e0e049ec8d17f00 (patch) | |
| tree | 1a500d0c7132f03094ac13684eec04a2480b8526 | |
| parent | 52a7ca4f612c774a2f87cab8d145b683f53c26ca (diff) | |
| download | perlweeklychallenge-club-ecb612591c012ba4de6480192e0e049ec8d17f00.tar.gz perlweeklychallenge-club-ecb612591c012ba4de6480192e0e049ec8d17f00.tar.bz2 perlweeklychallenge-club-ecb612591c012ba4de6480192e0e049ec8d17f00.zip | |
Challenge 2
| -rw-r--r-- | challenge-122/simon-proctor/raku/ch-2.raku | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/challenge-122/simon-proctor/raku/ch-2.raku b/challenge-122/simon-proctor/raku/ch-2.raku new file mode 100644 index 0000000000..1c10942d42 --- /dev/null +++ b/challenge-122/simon-proctor/raku/ch-2.raku @@ -0,0 +1,11 @@ +#!/usr/bin/env raku + +#| Given a number print all the possible ways to score that in basketball +sub MAIN (Int() $N) { + .say for (|(1 xx $N), |(2 xx $N), |(3 xx $N)) + .combinations(1..$N) + .unique(:with(&[eqv])) + .grep( -> @l { ([+] @l) ~~ $N } ) + .map( -> @l { @l.permutations.unique(:with(&[eqv])).Slip } ) + .map( *.join(",") ) +} |
