Closed philoskim closed 4 years ago
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.
[:a :b :c [1 2 3 4]]
[:a :b :c 1 3 [2 4]]
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.
Yes, it's possible:
(transform (subselect (multi-path (srange 3 3) [LAST ALL odd?])) (fn [res] [(rest res)]) data)
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.