ghiden (3) [Avatar] Offline
#1
v16 p149: if you pass something like this, it returns true

(string-palindrome? "Was it a car or a cat I saa")
reborg (10) [Avatar] Offline
#2
Argh, thanks. For quick review, here's the fixed example (I also changed other things, but the main problem was the range stopping at 0 instead of -1):

(require '[clojure.string :as s])

(defn palindrome? [xs cnt] ; (1)
  (let [idx (range (quot cnt 2) -1 -1)] ; (2)
    (every? #(= (nth xs %) (nth xs (- cnt % 1))) idx))) ; (3)

(defn string-palindrome? [s] ; (4)
  (let [chars (some->> s
                s/lower-case
                (remove #(Character/isWhitespace %)))]
    (palindrome? chars (count chars))))

(string-palindrome? "Was it a car or a cat I saw")
;; true
(string-palindrome? "Was it a car or a cat I saa")
;; false
ghiden (3) [Avatar] Offline
#3
Cool!