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