added traversed
This commit is contained in:
parent
dfedd30b29
commit
508e1d08ed
2 changed files with 15 additions and 10 deletions
|
|
@ -4,6 +4,7 @@
|
|||
* Enhanced dynamic navigators to continue expanding if any other dynamic navs are returned
|
||||
* Added `eachnav` to turn any 1-argument navigator into a navigator that accepts any number of arguments, navigating by each argument in order
|
||||
* `keypath` and `must` enhanced to take in multiple arguments for concisely specifying multiple steps
|
||||
* Added `traversed`
|
||||
* Bug fix: Fix regression from 0.13.0 where [ALL FIRST] on a PersistentArrayMap that created duplicate keys would create an invalid PersistentArrayMap
|
||||
* Bug fix: Fix problems with multi-path and if-path in latest versions of ClojureScript
|
||||
* Bug fix: Inline compiler no longer flattens and changes the type of sequential params
|
||||
|
|
|
|||
|
|
@ -842,21 +842,13 @@
|
|||
(defdynamicnav filterer
|
||||
"Navigates to a view of the current sequence that only contains elements that
|
||||
match the given path. An element matches the selector path if calling select
|
||||
on that element with the path yields anything other than an empty sequence.
|
||||
|
||||
The input path may be parameterized, in which case the result of filterer
|
||||
will be parameterized in the order of which the parameterized selectors
|
||||
were declared."
|
||||
on that element with the path yields anything other than an empty sequence."
|
||||
[& path]
|
||||
(subselect ALL (selected? path)))
|
||||
|
||||
(defdynamicnav transformed
|
||||
"Navigates to a view of the current value by transforming it with the
|
||||
specified path and update-fn.
|
||||
|
||||
The input path may be parameterized, in which case the result of transformed
|
||||
will be parameterized in the order of which the parameterized navigators
|
||||
were declared."
|
||||
specified path and update-fn."
|
||||
[path update-fn]
|
||||
(late-bound-nav [late (late-path path)
|
||||
late-fn update-fn]
|
||||
|
|
@ -865,6 +857,18 @@
|
|||
(transform* [this structure next-fn]
|
||||
(next-fn (compiled-transform late late-fn structure)))))
|
||||
|
||||
(defdynamicnav traversed
|
||||
"Navigates to a view of the current value by transforming with a reduction over
|
||||
the specified traversal."
|
||||
[path reduce-fn]
|
||||
(late-bound-nav [late (late-path path)
|
||||
late-fn reduce-fn]
|
||||
(select* [this structure next-fn]
|
||||
(next-fn (reduce late-fn (compiled-traverse late structure))))
|
||||
(transform* [this structure next-fn]
|
||||
(next-fn (reduce late-fn (compiled-traverse late structure)))
|
||||
)))
|
||||
|
||||
(def
|
||||
^{: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."}
|
||||
|
|
|
|||
Loading…
Reference in a new issue