Fork me on GitHub
Busy escaping the comfort zone01:12:58

Hey, looking for a way of selecting items from a Vector using Specter (like srange but for any index), couldn't find a way of doing: (select [ALL <?>] [[1 2 3 4 5] [1 2 3 6 7]]) -> [[2 5] [2 7]]

Busy escaping the comfort zone01:12:12

(select [ALL (multi-path (keypath 1) (keypath 4)) ] rs)

Busy escaping the comfort zone01:12:20

but it flattens out the result

Busy escaping the comfort zone01:12:34

A possible solution might be to use: (transform [ALL (s/collect-one (keypath 0) ) (s/collect-one (keypath 1) )] (fn [a b c] [a b]) rs) which feels a bit akward (I would like to have the ability so select neste sub vectors)


@narkisr you can use subselect


subselect + multi-path should get you the behavior you want

Busy escaping the comfort zone01:12:52

Ok, thanks! ill try to use them


(select [ALL (subselect (multi-path (keypath 1) (keypath 4)))] [[1 2 3 4 5] [1 2 3 6 7]])

Busy escaping the comfort zone02:12:38

BTW is there any reason why indices are not treated like map keys? (since both access assosciative DS)

Busy escaping the comfort zone02:12:52

You need to wrap them using keypath


I just stuck with implementing implicit behavior that's analogous to what clojure already treats as functions


@narkisr namely keywords and sets


you could always implement that yourself if you want it, see ImplicitNav