Hi BG, Laurent dragged me in the conversation so here is my take https://gist.github.com/2823916 which strictly follows your proposed "syntax".
hth, Christophe On Sat, May 26, 2012 at 6:58 AM, Baishampayan Ghose <b.gh...@gmail.com>wrote: > Hi, > > I have a problem wherein I need to select subsets of a given map; > think about select-keys, but with arbitrary nesting. > > For example, consider this map - > > (def my-map {:name "John Doe" > :email "j...@doe.com" > :address {:house "42" > :street "Moon St." > :city "San Francisco" > :state "CA" > :zip 76509 > :mobile "+188888888"} > :ssn "123456" > :spouse {:name "Jane Doe" > :ssn "654321" > :relation :wife > :address {:house "42" > :street "Moon St." > :city "Atlanta" > :state "GA" > :zip 76509 > :mobile "+188888888"}}}) > > From the above map, I want to extract this sub-map - > > {:spouse {:name "Jane Doe", :address {:state "GA", :city "Atlanta"}}, > :name "John Doe", > :email "j...@doe.com", > :address {:state "CA", :city "San Francisco"}} > > What would be a good way to express this sub-map so that I can pass it > on to a function? > > I am thinking about something like this - > > [:name :email {:address [:city :state]} {:spouse [:name {:address > [:city :state]}]}] > > Example implementations are also welcome. > > Regards, > BG > > -- > Baishampayan Ghose > b.ghose at gmail.com > > -- > 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 > -- Professional: http://cgrand.net/ (fr) On Clojure: http://clj-me.cgrand.net/ (en) -- 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