a) If your map represents an "record" with "fields" (for instance if it would make sense to also represent it as record via defrecord), then use (:field map)
b) If your map is a collection of key/vals, then use (map key) Rationale for a): it will allow better migration path if you use defrecords at some point, and conveys the semantic that you know there should be the given key in the map Rationale for b): you have an existing map, but the key may or may not be present. Note that you can also use the version which returns default value if there's no key in the map: (map key default-value) Rich already mentioned all this, better, in an earlier email which I'm too lazy to search for right now. -- Laurent 2013/1/29 Jonathon McKitrick <[email protected]>: > Either one works, is there any kind of guideline on which to prefer, when? > Or is it entirely personal preference? It seems each way could be more > readable in different circumstances.... > > -- > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > [email protected] > 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 unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] 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 unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
