On Oct 19, 3:12 am, kwatford <[EMAIL PROTECTED]> wrote:
> Sorry if this has been asked before, but I couldn't find anything on
> it.
> If I have: (def A [ [ 1 2 3 ] [ 4 5 6 ] ] )
> then if I want to access a specific element, I have to do:
> ((A 1) 1) -or- (get (get A 1) 1)
get-in is probably what you are looking for.
user=> (get-in A [1 1])
5
There is also, update-in and assoc-in.
Parth
> I could make a macro for this of course, but I'd kind of like to
> change the call semantics for vectors/maps to allow (A 1 1), perhaps
> something like:
> (myvec index &more) -> (if more (apply (myvec index) more), (get myvec
> index))
>
> I don't think adding this should conflict with any existing code,
> though I did notice that "get" currently accepts and apparently
> ignores one extra parameter.
>
> This seem like a reasonable feature request?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---