Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure by
I have not run across this with running code, so perhaps it is impossible for reasons I have not understood.  Also not sure whether fixing issues with reducers is of any importance, given transducers.  This was found while testing the Eastwood lint tool on some Clojure namespaces, including clojure.core.reducers.


(defcurried mapcat
  "Applies f to every value in the reduction of coll, concatenating the result
  colls of (f val). Foldable."
  {:added "1.5"}
  [f coll]
  (folder coll
   (fn [f1]
     (let [f1 (fn
                ([ret v]
                  (let [x (f1 ret v)] (if (reduced? x) (reduced x) x)))
                ([ret k v]
                  (let [x (f1 ret k v)] (if (reduced? x) (reduced x) x))))]
       (rfn [f1 k]
            ([ret k v]
               (reduce f1 ret (f k v))))))))

The definition of macro rfn expands to a (fn ...) that can call f1 with no arguments, which is not a defined arity for f1.

1 Answer

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-1612 (reported by jafingerhut)
...