I've enclosed a modified definition of update-in that allows the update function "f" to take arguments in addition to "old" value being updated. The new definition does everything the old definition does (when additional arguments are not supplied), but it allows "f" to be an existing function more of the time rather than a new closure that packages up additional arguments.
Here's an example: user=> (def m {:a {:b 1}}) #=(var user/m) user=> (update-in m [:a :b] inc) {:a {:b 2}} user=> (update-in m [:a :b] #(+ % 2)) ; current or new {:a {:b 3}} user=> (update-in m [:a :b] + 2) ; new {:a {:b 3}} Suggested update-in: (defn update-in "'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created." ([m [k & ks] f & args] (if ks (assoc m k (apply update-in (get m k) ks f args)) (assoc m k (apply f (get m k) args))))) --Steve --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---