Why does the inline/get macro take [m k & nf] arguments?
Having more than one not-found argument in the expanded (clojure.lang.RT/get ..) form seems to be clearly an error.
Similarly, is there a reason why inline/get-in does not take a not-found argument?
I added one like so:
(defmacro get-in
"Like `get-in` but faster and uses code generation.
`ks` must be either vector, list or set."
([m ks]
{:pre [(u/simple-seq? ks)]}
(lens/get (fn [k] `(get ~k)) m ks))
([m ks nf]
{:pre [(u/simple-seq? ks)]}
(let [g (gensym)]
`(let [~g ~nf]
~(lens/get (fn [k] `(get ~k ~g)) m ks)))))
Why does the
inline/get
macro take[m k & nf]
arguments? Having more than onenot-found
argument in the expanded(clojure.lang.RT/get ..)
form seems to be clearly an error.Similarly, is there a reason why
inline/get-in
does not take anot-found
argument?I added one like so: