I get this error:
IllegalArgumentException Don't know how to create ISeq from: clojure.lang.Symbol clojure.lang.RT.seqFrom (RT.java:542)
when I call this function:
(defn my-butlast [lista]
(loop [c lista
last ()]
(if (= (count c) 1)
last
(recur (concat last (first c))
(pop c)))))
The function should return a list with the same elements as its input list but excluding the last element, or '()' if it's empty.
And the error only happens when the list has two or more elements like this:
(my-butlast '(a b))