I have several functions that relate to lists. I have an even function that takes a list parameter and gets even list indices. An odd function does the same, but with odd indices. I also have another function that combines two sorted lists with the name merge-list, which takes two lists as parameters.
The problem with the function I'm writing now: merge-sort.
Here is what I have:
(defn merge-sort [lis]
(if (empty? (rest lis))
lis
(merge-list (merge-sort (odd(lis))) (merge-sort (even(lis))))))))
For some reason, I keep getting an error
java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn
I can pass the odd rest lis function as follows (odd(rest lis))(same with even). It works fine, but that clearly doesn't give me the solution I want.
Clojure, . .