Public Vars

Back

reset-vals! (clj)

(source)

function

(reset-vals! atom newval)
Sets the value of atom to newval. Returns [old new], the value of the atom before and after the reset.

Examples

typedclojure/typedclojure
(ns ^:no-doc typed.ann.clojure
  "Type annotations for the base Clojure distribution."
  #?(:cljs (:require-macros [typed.ann-macros.clojure :as macros]))
  (:require [clojure.core :as cc]
            [typed.clojure :as t]
            #?(:clj [typed.ann-macros.clojure :as macros])
            #?(:clj typed.ann.clojure.jvm) ;; jvm annotations
            #?(:clj clojure.core.typed))
  #?(:clj
     (:import (clojure.lang PersistentHashSet PersistentList
                            APersistentMap #_IPersistentCollection
                            #_ITransientSet
                            IRef)
              (java.util Comparator Collection))))

cc/reset! (t/All [x] [(t/Atom x) x :-> x])
cc/swap! (t/All [x b :..] [(t/Atom x) [x b :.. b :-> x] b :.. b :-> x])
#?@(:cljs [] :default [
cc/reset-vals! (t/All [x] [(t/Atom x) x :-> '[x x]])
cc/swap-vals! (t/All [x b :..] [(t/Atom x) [x b :.. b :-> x] b :.. b :-> '[x x]])
])
cc/vreset! (t/All [x] [(t/Volatile x) x :-> x])
cc/volatile? (t/Pred t/AnyVolatile)
cc/compare-and-set! (t/All [x] [(t/Atom x) t/Any x :-> t/Bool])