add terminal-val

This commit is contained in:
Nathan Marz 2016-06-22 21:00:31 -04:00
parent 2f5d601ccf
commit 898d7489a6

View file

@ -9,6 +9,7 @@
defnav defnav
defpathedfn defpathedfn
richnav richnav
defnavconstructor
]] ]]
[com.rpl.specter.util-macros :refer [com.rpl.specter.util-macros :refer
[doseqres]] [doseqres]]
@ -21,7 +22,8 @@
defcollector defcollector
defnav defnav
defpathedfn defpathedfn
richnav]] richnav
defnavconstructor]]
#+clj [com.rpl.specter.util-macros :only [doseqres]] #+clj [com.rpl.specter.util-macros :only [doseqres]]
) )
(:require [com.rpl.specter.impl :as i] (:require [com.rpl.specter.impl :as i]
@ -219,6 +221,13 @@
(i/terminal* params params-idx vals structure) (i/terminal* params params-idx vals structure)
))) )))
(defnavconstructor terminal-val
"Like `terminal` but specifies a val to set at the location regardless of
the collected values or the value at the location."
[p terminal]
[v]
(p (constantly v)))
(def (def
^{:doc "Navigate to every element of the collection. For maps navigates to ^{:doc "Navigate to every element of the collection. For maps navigates to
a vector of `[key value]`."} a vector of `[key value]`."}