define pred using defnav so it uses lean navigation when possible

This commit is contained in:
Nathan Marz 2016-08-08 10:16:32 -04:00
parent 6024195229
commit 9a35c0666d

View file

@ -514,11 +514,15 @@
(transform* [this structure next-fn]
(next-fn (compiled-transform late update-fn structure)))))
(def
(defnav
^{:doc "Keeps the element only if it matches the supplied predicate. This is the
late-bound parameterized version of using a function directly in a path."}
pred
i/pred*
[afn]
(select* [this structure next-fn]
(if (afn structure) (next-fn structure) NONE))
(transform* [this structure next-fn]
(if (afn structure) (next-fn structure) structure))
)
(extend-type nil