On Jun 4, 2010, at 14:03 , Joost wrote:

> On Jun 4, 1:42 pm, "Heinz N. Gies" <he...@licenser.net> wrote:
>> Sorry I mixed arguments, it should be (update-in {1 2} [] (constantly {2 3}))
> 
> Yes, that gives {nil {2 3}, 1 2}
> 
> You're not giving any key in the key list, so that is the reason
> there's a nil key now, and {2 3} is just the value that you give it,
> since that's what ((constantly {2 3}) nil) returns.
> 
> Seems correct as far as the documentation of update-in is concerned.
> 
I'd expect that a empty key works on the entire  map, just as get-in with en 
empty key returns the entire map, this is kind of very important if you work 
with automatically with keys since otherwise you always have to handle the 
special case []. This is very annoying :(

here an example:

(if-let [r (butlast @path)]
                      (do
                        (alter m update-in r dissoc (last @path))
                        (alter m update-in r assoc {:name @sr} c))
                      (do
                        (alter m dissoc (last @path))
                        (alter m assoc {:name @sr} c)))

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