Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Clojure Programming/Examples/API Examples/Reference Tools

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

ref See ref-set for more. user=> (def cross-thread-mutable (ref {})) #'user/cross-thread-mutable user=> cross-thread-mutable #<Ref clojure.lang.Ref@1a5f739> user=> ref-set user=> (def foo (ref 0)) #'user/foo user=> foo #<Ref clojure.lang.Ref@7c2479a4> user=> @foo 0 user=> (ref-set foo 1) java.lang.IllegalStateException: No transaction running (NO_SOURCE_FILE:0) user=> (dosync (ref-set foo 1)) 1 user=> @foo 1 deref @ (deref (ref 5)) @(ref 5) @(atom 5) (with-local-vars [x 5] @x) @(agent 5) delay force (def df (delay (println "hello"))) (println "world") --> world (force df) --> hello commute (def employee-records (ref #{})) (dosync (commute employee-records conj "employee"))