aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-11-19 10:06:15 +0000
committerGitHub <noreply@github.com>2021-11-19 10:06:15 +0000
commit7ebf4f9e8b9450fb1318fcb496cf812fadab4968 (patch)
tree3eb5568633828b580cdf67ff3c99973ff043baed
parent78f6ceb626318a268987150fc9bdd97754b8156d (diff)
parent8363b21e19211a06b41b46ea218cf432950c9e06 (diff)
downloadperlweeklychallenge-club-7ebf4f9e8b9450fb1318fcb496cf812fadab4968.tar.gz
perlweeklychallenge-club-7ebf4f9e8b9450fb1318fcb496cf812fadab4968.tar.bz2
perlweeklychallenge-club-7ebf4f9e8b9450fb1318fcb496cf812fadab4968.zip
Merge pull request #5245 from wambash/challenge-week-139
solutions week 139
-rw-r--r--challenge-139/wambash/raku/ch-1.raku18
-rw-r--r--challenge-139/wambash/raku/ch-2.raku32
2 files changed, 50 insertions, 0 deletions
diff --git a/challenge-139/wambash/raku/ch-1.raku b/challenge-139/wambash/raku/ch-1.raku
new file mode 100644
index 0000000000..b312075a1e
--- /dev/null
+++ b/challenge-139/wambash/raku/ch-1.raku
@@ -0,0 +1,18 @@
+#!/usr/bin/env raku
+
+sub jort-sort (+@n) {
+ [before] @n
+}
+
+multi MAIN (Bool :test($)!){
+ use Test;
+ is jort-sort(1,2,3,4,5), True;
+ is jort-sort(1,3,2,4,5), False;
+ is jort-sort(<a b s z>), True;
+ is jort-sort(<a b s c z>), False;
+ done-testing;
+}
+
+multi MAIN (*@n) {
+ say +jort-sort @n
+}
diff --git a/challenge-139/wambash/raku/ch-2.raku b/challenge-139/wambash/raku/ch-2.raku
new file mode 100644
index 0000000000..622dd0035a
--- /dev/null
+++ b/challenge-139/wambash/raku/ch-2.raku
@@ -0,0 +1,32 @@
+#!/usr/bin/env raku
+
+sub is-long ( $n ) {
+ 1 / $n
+ andthen .base-repeating[1]
+ andthen .chars == $n - 1
+}
+
+sub is-long-prime ( $n ) {
+ $n
+ andthen .&is-long & .is-prime
+ andthen .so
+}
+
+multi MAIN (Bool :test($)!){
+ use Test;
+ is is-long( 2),False;
+ is is-long( 7), True;
+ is is-long(17), True;
+ is is-long-prime( 2),False;
+ is is-long-prime( 7), True;
+ is is-long-prime(17), True;
+ done-testing;
+}
+
+multi MAIN ($n=5) {
+ 2..*
+ andthen .grep: &is-long-prime
+ andthen .head: $n
+ andthen .batch: 5
+ andthen .map: *.put
+}