aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2020-12-16 05:09:32 +0000
committerGitHub <noreply@github.com>2020-12-16 05:09:32 +0000
commit13359c4c7e261ea9ffd2b393fc78bc5918e93463 (patch)
tree150355a488aa755af1dff1974e624d76d7a7d115
parentb799a1456474e592554f0945af9904665ece7999 (diff)
parent78a525261e905d3a845a0af11d11f2727c7deb4d (diff)
downloadperlweeklychallenge-club-13359c4c7e261ea9ffd2b393fc78bc5918e93463.tar.gz
perlweeklychallenge-club-13359c4c7e261ea9ffd2b393fc78bc5918e93463.tar.bz2
perlweeklychallenge-club-13359c4c7e261ea9ffd2b393fc78bc5918e93463.zip
Merge pull request #2997 from stuart-little/stuart-little_029
1st commit on 029
-rw-r--r--challenge-029/stuart-little/README1
-rwxr-xr-xchallenge-029/stuart-little/raku/ch-1.p612
-rwxr-xr-xchallenge-029/stuart-little/raku/ch-2.p610
3 files changed, 23 insertions, 0 deletions
diff --git a/challenge-029/stuart-little/README b/challenge-029/stuart-little/README
new file mode 100644
index 0000000000..78439907de
--- /dev/null
+++ b/challenge-029/stuart-little/README
@@ -0,0 +1 @@
+Solutions by Stuart Little
diff --git a/challenge-029/stuart-little/raku/ch-1.p6 b/challenge-029/stuart-little/raku/ch-1.p6
new file mode 100755
index 0000000000..9a407dfb10
--- /dev/null
+++ b/challenge-029/stuart-little/raku/ch-1.p6
@@ -0,0 +1,12 @@
+#!/usr/bin/env perl6
+use v6;
+
+# run as <script> <quoted string>
+# or just <script> to default to the example at https://perlweeklychallenge.org/blog/perl-weekly-challenge-029/
+
+for ((@*ARGS) ?? @*ARGS[0] !! 'Perl {Daily,Weekly,Monthly,Yearly} Challenge')
+.words
+.map({ ($_ ~~ /^\{(.*)\}$/) ?? ($0.Str.split(',')) !! ($_,) })
+.reduce(&infix:<X>).map(*.join(' ')) {.say}
+
+
diff --git a/challenge-029/stuart-little/raku/ch-2.p6 b/challenge-029/stuart-little/raku/ch-2.p6
new file mode 100755
index 0000000000..65be591112
--- /dev/null
+++ b/challenge-029/stuart-little/raku/ch-2.p6
@@ -0,0 +1,10 @@
+#!/usr/bin/env perl6
+use v6;
+
+# run as <script> <string>
+
+use NativeCall;
+
+sub c_strlen(Str $str) returns int32 is native('c') is symbol('strlen') {*}
+
+say c_strlen(@*ARGS[0]);