Re: Core functions for searching lists of values

2016-01-28 Thread Alan Moore
Core may do what you need but for future needs you might reach for Nathan Marz's specter library which helps navigate and manipulate complex Clojure data: https://github.com/nathanmarz/specter Take care. Alan -- You received this message because you are subscribed to the Google Groups "Clojur

Re: Core functions for searching lists of values

2016-01-28 Thread cyclops
Thanks for the replies. Certainly naming the function is a good idea. But although it avoid using anonymous functions, I was also wondering if there were existing core functions that could search a list of hashes - it seems like something that would have come up before. Then again, possibly it's

Re: Core functions for searching lists of values

2016-01-28 Thread Walter van der Laan
You could use 'select-keys' to filter the hashmaps; (defn submap? [m1 m2] (= m1 (select-keys m2 (keys m1 (filter (partial submap? {:quad-col 0 :quad-row 0}) test-galaxy) (filter (partial submap? {:sec-row 4 :sec-col 4}) test-galaxy) (filter (partial submap? {:type :star}) test-galaxy) --

Re: Core functions for searching lists of values

2016-01-27 Thread Jonah Benton
Hey cycl...@speakeasy.net, Jay's excellent main point is really about the use of anonymous functions- that in many cases it's an anti-pattern. Having a name for every function means that those functions become testable and that code consuming those functions stays readable. Another point is that