diff options
| author | Kang-min Liu <gugod@gugod.org> | 2021-01-19 23:19:44 +0900 |
|---|---|---|
| committer | Kang-min Liu <gugod@gugod.org> | 2021-01-19 23:19:44 +0900 |
| commit | 36b1f754eb8d9d230e6c1577dc9063a46f914cd0 (patch) | |
| tree | b8b62163dd636316ea94433511330e6c2718f313 | |
| parent | 8ea7856804c9fdf27fd8e4a0ab576cf5255df9a1 (diff) | |
| download | perlweeklychallenge-club-36b1f754eb8d9d230e6c1577dc9063a46f914cd0.tar.gz perlweeklychallenge-club-36b1f754eb8d9d230e6c1577dc9063a46f914cd0.tar.bz2 perlweeklychallenge-club-36b1f754eb8d9d230e6c1577dc9063a46f914cd0.zip | |
a solution to pwc 096.1 in janet
| -rw-r--r-- | challenge-096/gugod/janet/ch-1.janet | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/challenge-096/gugod/janet/ch-1.janet b/challenge-096/gugod/janet/ch-1.janet new file mode 100644 index 0000000000..f3d0e18544 --- /dev/null +++ b/challenge-096/gugod/janet/ch-1.janet @@ -0,0 +1,15 @@ + +(defn reverse-words + "Reverse the string word by word" + [S] + (string/join (reverse (filter (fn [x] (not (= x ""))) + (string/split " " S))) + " ")) + +# main +(loop [x :in @["The Weekly Challenge" + " Perl and Raku are part of the same family " + "join reverse split $S"]] + (print (string + "Input: " x "\n" + "Output: " (reverse-words x)))) |
