I am working on a clojure function which accepts a variable number of arguments, and passes those to a java method call
(defn foo [var1 var2 & vars]
(let [bar (.foo var1)]
(.gaz bar var2 vars)))
This works when vars is empty, but when I put something in vars, I get
java.lang.ClassCastException: Cannot cast clojure.lang.ArraySeq to [Ljava.lang.Object;
It seems like the vars arent being spliced / interpolated into a vararg list to the method call. How can I do this? I want to use this as both
(foo a b)
and
(foo a b c d e f)
And have it calling
(.gaz bar b c d e f) ;; <- note the list is embedded