user=> (def database (atom {:henk {:username "henk" :password "johnson" :session "test"}
:steve {:username "steve" :password "boldwin" :session "test2"}
:cane {:username "cane" :password "john" :session "test3"}}))
#'user/database
user=> (:henk @database)
{:session "test", :username "henk", :password "johnson"}
変更するには:
user=> (swap! database assoc-in [:henk :session] "test + swap")
{:cane {:session "test3", :username "cane", :password "john"},
:henk {:session "test + swap", :username "henk", :password "johnson"},
:steve {:session "test2", :username "steve", :password "boldwin"}}
値が更新されていることを確認します。
user=> @database
{:cane {:session "test3", :username "cane", :password "john"},
:henk {:session "test + swap", :username "henk", :password "johnson"},
:steve {:session "test2", :username "steve", :password "boldwin"}}