On Wed, Dec 10, 2008 at 1:40 PM, Daniel Eklund <[EMAIL PROTECTED]> wrote:
>
> user> (path-rebind nested-structure [:nested1 :nested2 :final-data]
> "new data")
> {:nested1 {:nested2 {:final-data "new data", :level 2}, :level
> 1}, :level 0}
Congratulations, you've implemented 'assoc-in' :-)
user=> (assoc-in nested-structure [:nested1 :nested2 :final-data] "new data")
{:nested1 {:nested2 {:level 2, :final-data "new data"}, :level 1}, :level 0}
There are also 'get-in' and 'update-in'.
Your code looks fine -- nearly identical to 'assoc-in' in fact. It
does the destructuring right in the function arguments, but everything
else is merely stylistic differences.
--Chouser
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---