I tend to prefer the latter as well, whenever possible.
- J.
I have code that gets passed a map (actually a struct-map), should I
(my-map :my-key)
or
(:my-key my-map)
I'm beginning to gravitate towards the latter, as it is more tolerant of the map being nil.
I have code that gets passed a map (actually a struct-map), should I
(my-map :my-key)
or
(:my-key my-map)
I'm beginning to gravitate towards the latter, as it is more tolerant of the map being 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