would it be possible to do the following sequence of multi-transform & select-one in one step?
that would allow me to package up this transform/select operation as a path (instead of a function), so it can be combined with further processing.
(->> {:cols [10 20 30]
:rows [[1 2 3]
[4 5 6]]}
(sp/multi-transform
[(collect-one :cols)
:rows ALL (terminal (partial mapv +))])
(sp/select-one :rows))
=> [[11 22 33] [14 25 36]]
equivalent clojure code:
(->> {:cols [10 20 30]
:rows [[1 2 3]
[4 5 6]]}
((fn [{:keys [cols rows]}]
(mapv
(fn [cells]
(mapv + cells cols))
rows))))
=> [[11 22 33] [14 25 36]]in more abstract terms, i want to
1. select from the input structure
2. transform the selected part
3. combine the transformed part with another selected and transformed part of the original structure
i can of course do all this in a regular clojure function, which i can compose with further select/transform operations via view, but do i have to?
i have the feeling, that im missing some navigator, so i can do this kind of multi collection map operation.
both view and transformed doesn't receive the collected values.
terminal / vterminal does receive collected values, but also the currently navigated value too, so i have to wrap clojure.core functions to ignore that last argument.
collected? receives all collected values, both individually or as a single vector, but it's return value is not used to replace the value, we are currently navigated to.
i think i wish for something like transformed-with-collected, so i can do the following:
(->> {:cols [10 20 30]
:rows [[1 2 3]
[4 5 6]]}
(sp/select-one
[(collect-one :cols)
:rows
(transformed-with-collected ALL (partial mapv +))
DISPENSE]))