From 42a264ab86774861bfae9f135c9e4bee7a8e19b8 Mon Sep 17 00:00:00 2001 From: Kang-min Liu Date: Wed, 13 Jan 2021 10:14:03 +0900 Subject: a solution to pwc 095.1 in janet-lang --- challenge-095/gugod/janet/ch-1.janet | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 challenge-095/gugod/janet/ch-1.janet diff --git a/challenge-095/gugod/janet/ch-1.janet b/challenge-095/gugod/janet/ch-1.janet new file mode 100644 index 0000000000..2da685f405 --- /dev/null +++ b/challenge-095/gugod/janet/ch-1.janet @@ -0,0 +1,15 @@ + +(defn is-palindrome + "Tell if the given string is a palindrome" + [s] + (= s (string/reverse s))) + +(defn is-palindrome-number + "Tell if the given number is palindromic" + [n] + (is-palindrome (string n))) + +(loop [n :in @[1221 -101 90]] + (print (string + "Input: " n "\n" + "Output: " (if (is-palindrome-number n) 1 0) "\n"))) -- cgit