ClojureDocs

导航

命名空间

swap!

clojure.core

从 1.0 版开始提供 (源代码)
  • (swap! atom f)
  • (swap! atom f x)
  • (swap! atom f x y)
  • (swap! atom f x y & args)
Atomically swaps the value of atom to be:
(apply f current-value-of-atom args). Note that f may be called
multiple times, and thus should be free of side effects.  Returns
the value that was swapped in.