(defn abcd [want got goal] (loop [w want g got d 0 c 0 b 0 a 0] (if (empty? w) [a b c d] (recur (rest w) (rest g) (if (= (first g) goal) (if (= (first w) goal) (inc d) d) d) (if (= (first g) goal) (if (not= (first w) goal) (inc c) c) c) (if (not= (first g) goal) (if (= (first w) goal) (inc b) b) b) (if (not= (first g) goal) (if (not= (first w) goal) (inc a) a) a))))) (defn abcd-stat [want got goal] (let [abcds (abcd want got goal) a (nth abcds 0) b (nth abcds 1) c (nth abcds 2) d (nth abcds 3) pd (if (= d 0) 0.0 (* 100.0 (/ d (+ b d)))) pf (if (= c 0) 0.0 (* 100.0 (/ c (+ a c))))] [pd pf])) (defn abcd-stats [want got goals] (loop [g goals result []] (if (empty? g) result (recur (rest g) (conj result (abcd-stat want got (first g)))))))