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 <dave...@gmail.com> 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
> <jmckitr...@gmail.com> 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 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 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
>



-- 
“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

Reply via email to