On Sat, Jul 16, 2011 at 9:16 PM, Alan Malloy <a...@malloys.org> wrote:
> On Jul 16, 7:11 pm, Asim Jalis <asimja...@gmail.com> wrote:
>> I've been using assoc-in and dissoc-in to navigate through nested
>> associative structures (HTTP requests). Had some questions:
>>
>> 1. Why doesn't dissoc-in take multiple key-sequences? For example:
>>
>> (dissoc-in m [:a :b :c] [:a :b :d])
>>
>> I can do this using a series of dissoc-in calls, but it might be
>> easier to just have this naturally there.
>
> (update-in m [:a :b] dissoc :c :d)
>
>> 2. Why isn't there a select-in? Even dissoc-in is in contrib instead
>> of in core. Is there an easier way to do these things that I am
>> missing?
>
> What is select-in supposed to do? It's either get-in+select-keys, or
> update-in+select-keys, depending on what you intend.
>
>> 3. Similar to #1, why doesn't assoc-in take a sequence of
>> key-sequences and values? For example:
>>
>> (assoc-in m [:a :b :c] 1 [:a :b :d] 2)
>>
>> Again this is possible by doing a sequence of assoc-in calls. Now is
>> the reason these are not provided to hint that this might not be the
>> most efficient way to do this kind of surgery?
>
> (update-in m [:a :b] assoc :c 1 :d 2)

Very nice. Thanks.

-- 
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

Reply via email to