Another common use case: leveraging the thrush operator. (-> odd-coll :foo :bar :baz)
On Friday, December 21, 2012 12:57:15 AM UTC+1, tbc++ wrote: > > I use them sometimes in transversing deep maps: > > (def odd-coll [{:foo {:bar {:baz 42}}} > {:foo {:bar {:baz 43}}}]) > > (def find-it (comp :baz :bar :foo)) > > (map find-it odd-coll) > > ; [42 43] > > > On Thu, Dec 20, 2012 at 4:41 PM, Dave Ray <dav...@gmail.com > <javascript:>>wrote: > >> You can avoid superfluous anonymous functions. For example, this: >> >> (map #(get % :id) my-sequence) >> >> vs this: >> >> (map :id my-sequence) >> >> Cheers, >> >> Dave >> >> >> On Thu, Dec 20, 2012 at 3:13 PM, Jonathon McKitrick >> <jmcki...@gmail.com <javascript:>> wrote: >> > I thought it was pretty interesting to treat maps as functions, and even >> > more intrigued at treating keywords as functions as well. >> > >> > What does this gain from a language design perspective, that you cannot >> get >> > with (get map keyword) or ever (map keyword)? Why the additional >> option of >> > (keyword map) ? >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups "Clojure" group. >> > To post to this group, send email to clo...@googlegroups.com<javascript:> >> > Note that posts from new members are moderated - please be patient with >> your >> > first post. >> > To unsubscribe from this group, send email to >> > clojure+u...@googlegroups.com <javascript:> >> > 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 post to this group, send email to clo...@googlegroups.com<javascript:> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> > > > > -- > “One of the main causes of the fall of the Roman Empire was that–lacking > zero–they had no way to indicate successful termination of their C > programs.” > (Robert Firth) > -- 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