1.3.0 permalink Arrow_down_16x16

ref-set

clojure.core

  • (ref-set ref val)
Must be called in a transaction. Sets the value of ref.
Returns val.

1 Example top

  • user=> (def foo (ref {}))
    #'user/foo
    
    user=> (dosync
             (ref-set foo {:foo "bar"}))
    {:foo "bar"}
    
    user=> @foo
    {:foo "bar"}
    
Log in to add / edit an example.

See Also top

  • 0
    clojure.core/ref

    Creates and returns a Ref with an initial value of x and zero or mo

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:2192 top

(defn ref-set
  "Must be called in a transaction. Sets the value of ref.
  Returns val."
  {:added "1.0"
   :static true}
  [^clojure.lang.Ref ref val]
    (. ref (set val)))
Vars in clojure.core/ref-set:
Used in 0 other vars

Comments top

No comments for ref-set. Log in to add a comment.