I want to compare two lists in clojure,
(def a '(1 2 3 4 5))
(def b '(3 2 7 8 10))
make the result (2 3) or (3 2) by comparing the elements from two lists.
(defn compareList[x, y]
(do
(def result '())
(def i 0)
(def j 0)
(while (< i 5)
(while (< j 5)
(if (= (nth x i) (nth y j))
(def result (conj (nth x i) result)))
(def j (inc j))
)
)
result))
(print (compareList a b))
this is my code. but the result is (). where am i wrong help me please.
source
share