Moe: Good point. The specific use case I had was that I wanted to be able to extract all the values that were on a path—in other words the ability to use a wildcard in get-in. For example, this returns "X1". I would like to use get-in to return ["X1" "X2"]. In other words use a wildcard for :b1.
(get-in {:a [{:b1 "X1"} {:b2 "X2"}]} [:a 0 :b1]) On Sat, Mar 4, 2017 at 1:14 PM, Moe Aboulkheir <m...@nervous.io> wrote: > > > On Sat, Mar 4, 2017 at 6:35 AM, Asim Jalis <asimja...@gmail.com> wrote: > >> What might be a Clojurey syntax for doing path navigation? In other words >> how could get-in be extended so that it could parse nested vectors like it >> parses nested maps? Thinking out aloud, an integer in the path when the >> data structure at that level is a vector should treat the integer as an >> index. >> > > If I'm reading you correctly, that is Clojure's current behaviour - > (get-in {:a [{:b "X"}]} [:a 0 :b]) => "X" > > Take care, > Moe > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.