On Oct 8, 4:45 am, James Reeves <[EMAIL PROTECTED]> wrote:
> Is there any disadvantage to making:
>
> (map-or-vector :foo "bar" 5)
>
> Equivalent to:
>
> (((map-or-vector :foo) "bar") 5)
>
> For hash maps and vectors? As far as I can see, this doesn't conflict
> with any other syntax, and it would cut down on the brackets when
> dealing with maps within maps.
>
It conflicts with the default value capability of get:
({:a 1 :b 2} :c 5)
-> 5
There is already get-in (also assoc-in and update-in) that make nested
associative structures easier:
(def m {:foo {"bar" [0 1 2 3 4 42]}})
(get-in m [:foo "bar" 5])
-> 42
Rich
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---