This question https://github.com/redplanetlabs/specter/issues/287 got me thinking about how to solve the problem in the general case and I thought it would be nice to have a subselect like nav that allowed transformation to multiple values like srange. While this implementation is broken it better illustrates what I mean:
(sp/defdynamicnav seqsubselect
[& path]
(sp/late-bound-nav
[late (sp/late-path path)]
(select*
[this structure next-fn]
(next-fn (sp/compiled-select late structure)))
(transform*
[this structure next-fn]
(let [select-result (sp/compiled-select late structure)]
(reduce
(fn [structure s]
(i/srange-transform* structure s (inc s) next-fn))
structure
(map #(.indexOf structure %) (reverse select-result)))))))
(sp/transform
[(seqsubselect
[sp/ALL
vector?])]
(fn [structure]
(mapcat
(fn [x]
(concat
(filter odd? x)
[(into [] (filter even? x))]))
structure))
[:a [2 4 6] :b [5 6 7 8] :c [3 5 7] :d [1 2 3 4]])
;; => [:a [2 4 6] :b 5 7 [6 8] :c 3 5 7 [] :d 1 3 [2 4]]