Maps are functions of their keys because that's what maps are. Keywords are functions of their maps because it is useful.
(def foo [{:name "Bob", :age 20}, {:name "Sue", :age 19}]) (sort-by :age foo) (sort-by :name foo) Note that sort-by doesn't specifically take a keyword or know what maps are. It just runs (keyfn x) on each thing to produce something it can hopefully sort on. Since keywords are functions on maps, this works out well. On Dec 11, 3:29 pm, "Aaron Cohen" <remled...@gmail.com> wrote: > Isn't it just asking for confusion? > > I really like that maps are functions of their keys though. --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---