aboutsummaryrefslogtreecommitdiff
path: root/challenge-075
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2020-08-25 05:47:05 +0100
committerGitHub <noreply@github.com>2020-08-25 05:47:05 +0100
commita24e75932083955f9aab2af8cdfaec5f0c1912af (patch)
tree736fb1e7cb0b6ec2510c05ff3bd60c39c23af5dd /challenge-075
parentfd1f031ae79f262a59491231fb638176af79f92f (diff)
parent24c0f5f15428df4ec254034a91a63da4ec1168bd (diff)
downloadperlweeklychallenge-club-a24e75932083955f9aab2af8cdfaec5f0c1912af.tar.gz
perlweeklychallenge-club-a24e75932083955f9aab2af8cdfaec5f0c1912af.tar.bz2
perlweeklychallenge-club-a24e75932083955f9aab2af8cdfaec5f0c1912af.zip
Merge pull request #2141 from holli-holzer/master
initial
Diffstat (limited to 'challenge-075')
-rw-r--r--challenge-075/markus-holzer/raku/ch-1.raku6
-rw-r--r--challenge-075/markus-holzer/raku/ch-2.bonus.raku5
-rw-r--r--challenge-075/markus-holzer/raku/ch-2.raku3
3 files changed, 14 insertions, 0 deletions
diff --git a/challenge-075/markus-holzer/raku/ch-1.raku b/challenge-075/markus-holzer/raku/ch-1.raku
new file mode 100644
index 0000000000..89608c02d6
--- /dev/null
+++ b/challenge-075/markus-holzer/raku/ch-1.raku
@@ -0,0 +1,6 @@
+sub c( $S, @C, *@c ) {
+ if ( my $s = @c.sum ) <= $S {
+ take [@c.sort] if $s == $S;
+ c( $S, @C, @c, $_ ) for @C }}
+
+say ( gather c 6, [1, 2, 4] ).unique: with => &[~~] \ No newline at end of file
diff --git a/challenge-075/markus-holzer/raku/ch-2.bonus.raku b/challenge-075/markus-holzer/raku/ch-2.bonus.raku
new file mode 100644
index 0000000000..49ddeadc20
--- /dev/null
+++ b/challenge-075/markus-holzer/raku/ch-2.bonus.raku
@@ -0,0 +1,5 @@
+my @A = (2, 1, 4, 5, 3, 7);
+
+.join(" ").say for reverse [Z]
+ (" ", "-", |(1..@A.max) ),
+ |@A.map({ $_, "-", |("#" xx $_), |(" " xx (@A.max - $_)) });
diff --git a/challenge-075/markus-holzer/raku/ch-2.raku b/challenge-075/markus-holzer/raku/ch-2.raku
new file mode 100644
index 0000000000..0409764f58
--- /dev/null
+++ b/challenge-075/markus-holzer/raku/ch-2.raku
@@ -0,0 +1,3 @@
+my @A = (3, 2, 3, 5, 7, 5);
+#my @A = (2, 1, 4, 5, 3, 7);
+say ( 1..@A ).map({ |@A.rotor($_ => 1 - $_) }).max({ .min * .elems }); \ No newline at end of file