Improve formatting.

This commit is contained in:
Chris O'Donnell 2016-06-14 16:54:30 -04:00
parent 6cb2dfceb4
commit 066f96d1f9

View file

@ -151,23 +151,22 @@ Binds the passed in seq of paths to `paths-binding`, which can be used in `selec
The implementation of `multi-path` is a nice example of the use of `variable-pathed-nav`. The implementation of `multi-path` is a nice example of the use of `variable-pathed-nav`.
```clojure ```clojure
=> (defpathedfn multi-path (defpathedfn multi-path [& paths]
[& paths] (variable-pathed-nav [compiled-paths paths]
(variable-pathed-nav [compiled-paths paths] (select* [this structure next-fn]
(select* [this structure next-fn] (->> compiled-paths
(->> compiled-paths ;; seq with the results of navigating each passed in path
;; seq with the results of navigating each passed in path (mapcat #(compiled-select % structure))
(mapcat #(compiled-select % structure)) ;; pass each result to the next navigator
;; pass each result to the following navigator (mapcat next-fn)
(mapcat next-fn) doall))
doall)) (transform* [this structure next-fn]
(transform* [this structure next-fn] ;; apply the transform to each passed in path in order
;; apply the transform to each passed in path in order (reduce
(reduce (fn [structure path]
(fn [structure path] (compiled-transform path next-fn structure))
(compiled-transform path next-fn structure)) structure
structure compiled-paths))))
compiled-paths))))
``` ```
## Collector Macros ## Collector Macros
@ -219,12 +218,10 @@ Binds the passed in path to `name`.
The implementation of `collect` is a good example of how `pathed-collector` can be used. The implementation of `collect` is a good example of how `pathed-collector` can be used.
```clojure ```clojure
=> (defpathedfn (defpathedfn collect [& path]
collect (pathed-collector [late path]
[& path] (collect-val [this structure]
(pathed-collector [late path] (compiled-select late structure))))
(collect-val [this structure]
(compiled-select late structure))))
``` ```
## Navigator Macros ## Navigator Macros