Is this possible in Specter?
philoskim opened this issue · comments
Philos Kim commented
I want to change the data structure [:a :b :c [1 2 3 4]]
into [:a :b :c 1 3 [2 4]]
by using Specter library.
In other words, what I want is to move only the odd numbers of the nested vector to the outer vector.
I cannot find the way and I wonder it can be achieved by using Specter.
If it is impossible, I hope that this feature could be added to the future version of Specter.
Nathan Marz commented
Yes, it's possible:
(transform (subselect (multi-path (srange 3 3) [LAST ALL odd?]))
(fn [res] [(rest res)])
data)