I'm very new to functional languages and I'm attempting to implement a simple append function in Clojure. My code:
(defn append
[lizt1 lizt2]
(cond
(empty? lizt1) lizt2
:else (def sq (cons (first sq lizt1) (append (rest sq lizt1) lizt2)))))
(let [x (quote (1 2 3))
y (quote (4 5 6))]
(append (x y))) )
I'm receiving an
clojure.lang.PersistentList cannot be cast to clojure.lang.IFn
exception so I'm assuming that the list that I'm attempting to pass to the function is not of compatible type(like if I were to execute a list function, and try to pass that). I thought that quoting the list would make it accessible by interface functions. Can someone help me conceptualize how to abstract a list in order to manipulate its data in a separate function?