I am learning about closures in Clojure and this function confused me:
(defn inc-maker
"Create a custom incrementor"
[inc-by]
#(+ % inc-by))
(def inc3 (inc-maker 3))
(inc3 7)
; => 10
As a JavaScript developer I couldn't figure out how the argument 7 was getting passed in because in Javascript you would have to write it like this:
const incMaker = incByX => incByY => incByX + incByY;
const incThree = incMaker(3);
incThree(7);
So my question is, and not that I'm wanting to turn Clojure in to Javascript, but is there a way to name parameters in anonymous Clojure functions?