document exact semantics of select*/transform* needed for Navigator
This commit is contained in:
parent
5087e500b7
commit
ec05c14225
1 changed files with 14 additions and 2 deletions
|
|
@ -1,8 +1,20 @@
|
||||||
(ns com.rpl.specter.protocols)
|
(ns com.rpl.specter.protocols)
|
||||||
|
|
||||||
(defprotocol Navigator
|
(defprotocol Navigator
|
||||||
(select* [this structure next-fn])
|
(select* [this structure next-fn]
|
||||||
(transform* [this structure next-fn]))
|
"An implementation of `select*` must call `next-fn` on each
|
||||||
|
subvalue of `structure`. The result of `select*` is specified
|
||||||
|
as follows:
|
||||||
|
|
||||||
|
1. `NONE` if `next-fn` never called
|
||||||
|
2. `NONE` if all calls to `next-fn` return `NONE`
|
||||||
|
3. Otherwise, any non-`NONE` return value from calling `next-fn`
|
||||||
|
")
|
||||||
|
(transform* [this structure next-fn]
|
||||||
|
"An implementation of `transform*` must use `next-fn` to transform
|
||||||
|
any subvalues of `structure` and then merge those transformed values
|
||||||
|
back into `structure`. Everything else in `structure` must be unchanged."
|
||||||
|
))
|
||||||
|
|
||||||
(defprotocol Collector
|
(defprotocol Collector
|
||||||
(collect-val [this structure]))
|
(collect-val [this structure]))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue