aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-095/gugod/janet/ch-1.janet15
1 files changed, 15 insertions, 0 deletions
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")))