aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKang-min Liu <gugod@gugod.org>2021-01-19 22:48:07 +0900
committerKang-min Liu <gugod@gugod.org>2021-01-19 23:00:58 +0900
commit827f442db4ed03985c62c1f754eb50f893032316 (patch)
tree356d6c12c2dfd56bf4353931e8c21951a0289e91
parentd177c88a00c0d97ab0e3b61fb827c5fe8ac210a5 (diff)
downloadperlweeklychallenge-club-827f442db4ed03985c62c1f754eb50f893032316.tar.gz
perlweeklychallenge-club-827f442db4ed03985c62c1f754eb50f893032316.tar.bz2
perlweeklychallenge-club-827f442db4ed03985c62c1f754eb50f893032316.zip
a solution of pwc 096.1 in Raku
-rw-r--r--challenge-096/gugod/raku/ch-1.raku16
1 files changed, 16 insertions, 0 deletions
diff --git a/challenge-096/gugod/raku/ch-1.raku b/challenge-096/gugod/raku/ch-1.raku
new file mode 100644
index 0000000000..b8985dc559
--- /dev/null
+++ b/challenge-096/gugod/raku/ch-1.raku
@@ -0,0 +1,16 @@
+sub MAIN {
+ my @examples = (
+ "The Weekly Challenge",
+ " Perl and Raku are part of the same family ",
+ "join reverse split \$S",
+ );
+
+ for @examples -> $S {
+ say "Input: $S";
+ say "Output: " ~ reverse-words($S);
+ }
+}
+
+sub reverse-words (Str $S --> Str) {
+ $S.words.reverse.join(" ");
+}