I am having similar problems with multiple koans, which is sort of ruining the fun for me.
73 tic-tac-toe works on the repl but times out when submitting. My solution
(fn tic-tac-toe [board]
(let [row-fn (fn [board] board)
col-fn (fn [board] (partition 3 (for [x (range 3) y (range 3)]
(get-in board [y x]))))
diag-fn (fn [board] (list
(for [x (range 3) y (range 3) :when (= x y)]
(get-in board [y x]))
(for [x (range 2 -1 -1) y (range 2 -1 -1) :when (= x y)]
(get-in board [y x]))))]
(loop [groups (apply concat (map #(%1 %2)
(vector row-fn col-fn diag-fn)
(repeat board)))]
(cond
(empty? groups) nil
(every? #{:x} (first groups)) :x
(every? #{:o} (first groups)) :o
:else (recur (rest groups))))))
And for 120 sum of square digits
(fn [nums]
(letfn [(digits [n]
(let [result n
expo (Math/floor (Math/log10 result))]
(loop [s []
r result
e expo]
(if (neg? e)
s
(recur (conj s (int (quot r (Math/pow 10 e))))
(rem r (Math/pow 10 e))
(dec e))))))
(sum-squared-components [digits]
(apply + (map #(* % %) digits)))]
(->> nums
(map digits)
(map sum-squared-components)
(map vector nums)
(filter (fn [[x y]] (< x y)))
(count))))
Would be nice to know what it is causing this behaviour.
- Toni