I am learning Clojure and using Clojure 1.5.1. It seems Clojure 1.5.1 no longer has the defnk macro. So, what is the equivalent for defnk in Clojure 1.5.1 ?
defnk
once resided in clojure-contrib, but didn't make the jump into a new package when clojure-contrib was splitted up into multiple packages.
Instead of defnk
you could use :keys
/:or
yourself to create default values for your function arguments, so
(defnk f [:b 43] (inc b))
becomes
(defn f [& {:keys [b] :or {b 1}}] (inc b))
If you don't like it this way, nothing stops you from taking the source of defnk
and use it yourself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With