redplanetlabs / specter

Clojure(Script)'s missing piece
Apache License 2.0
2.52k stars 105 forks source link

Keep only collected #273

Closed barrtrek closed 5 years ago

barrtrek commented 5 years ago

Is there a navigator or a method for keeping only the 'collected' values in a select?

For instance (select (collect :a) {:a "hey"}) gives us -> [[["hey"] {:a "hey"}]]

Is there anything like: (select [(keep-only-collected (collect :a))] {:a "hey"}) ->[["hey"]]

Or (select [(collect :a) KEEP-ONLY-COLLECTED] {:a "hey"}) ->[["hey"]]

Obviously things can be transformed or run through a map first, but if I can keep this in a navigator, it would help my code out a bit. Have tried a few things with the view function, but nothing very promising yet.

Thanks!

nathanmarz commented 5 years ago

No, this isn't possible. When collecting multiple values in a select the general pattern is for the navigated value to be the last collected value.