On Fri, Jun 19, 2009 at 3:46 AM, Christophe Grand<christo...@cgrand.net> wrote: > > I would further your reasoning on tolerance: it depends on whether the key, > the map or both are variable. > (key map) is safe as long as you know that key is a symbol or a keyword. > (map key) is safe as long as you know that map will not be nil. > (get map key) never fails ((get (Object.) (Object.)) returns nil)
I use nil tolerance as my main guide. Also, whether or not I want to allow 'map' to actually be a non-map function. If that's all a wash, then I go for esthetics: if key is a literal keyword I'll usually put it first, if key is not a keyword and map is more complex that a simple local or var I'll usually use 'get'. An example of that last point, I think: (@(:state-map my-obj) field-id-num) is more confusing than: (get @(:state-map my-obj) field-id-num) --Chouser --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---