Hello,
I’m at the absolute beginning of my Clojure journey and currently following Aphyr’s turotiral (Clojure from the ground up: sequences). There is this exercise: “Write a function to find out if a string is a palindrome–that is, if it looks the same forwards and backwards.”
How I would solve it is like this:
(defn palindrome [word]
(== word (apply str (reverse word))))
but when I run it in my reply I get an error: Execution error (ClassCastException) at user/palindrome (REPL:2).
class clojure.lang.PersistentVector cannot be cast to class java.lang.Number (clojure.lang.PersistentVector is in unnamed module of loader ‘bootstrap’; java.lang.Number is in module java.base of loader ‘bootstrap’)
Can someone help me understand what I’m doing wrong? (also: is this the place to ask questions like these?)
Thank you in advance!