I have a function that returns another function, cons-then-eval-fn:
(defn cons-then-eval-fn [x]
(fn [& e] (cons x (eval e))))
From that, I define two instances of this concept, one using cons-then-eval-fn, the other doing the same thing but with inlined code:
(def zero-a (cons-then-eval-fn 0))
(def zero-b (fn [& e] (cons 0 (eval e))))
With some arguments, these two functions behave identically (as I would expect):
(zero-a) => (0)
(zero-b) => (0)
(zero-a identity []) => (0)
(zero-b identity []) => (0)
But with these arguments, I see differing behavior:
(zero-b zero-b identity []) => (0 0)
(zero-a zero-a identity []) =>
IllegalArgumentException No matching ctor found
Can anyone please help me understand why this happens?