diff options
| author | Kang-min Liu <gugod@gugod.org> | 2021-01-19 22:48:07 +0900 |
|---|---|---|
| committer | Kang-min Liu <gugod@gugod.org> | 2021-01-19 23:00:58 +0900 |
| commit | 827f442db4ed03985c62c1f754eb50f893032316 (patch) | |
| tree | 356d6c12c2dfd56bf4353931e8c21951a0289e91 | |
| parent | d177c88a00c0d97ab0e3b61fb827c5fe8ac210a5 (diff) | |
| download | perlweeklychallenge-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.raku | 16 |
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(" "); +} |
