Liking cljdoc? Tell your friends :D

hara.state.base.common


cloneclj

(clone obj)
(clone obj opts)

clones the state object

(-> (state/container :volatile) (state/create 2) (state/clone)) => volatile?

clones the state object

(-> (state/container :volatile)
    (state/create 2)
    (state/clone))
=> volatile?
raw docstring

containerclj

(container key)

returns the class of container given a label

(state/container :atom) => clojure.lang.Atom

(state/container :volatile) => clojure.lang.Volatile

returns the class of container given a label

(state/container :atom)
=> clojure.lang.Atom

(state/container :volatile)
=> clojure.lang.Volatile
raw docstring

copyclj

(copy source sink)
(copy source sink opts)

copies the value of one state to another

(def -a- (ref nil)) (state/copy (atom 1) -a-) @-a- => 1

copies the value of one state to another

(def -a- (ref nil))
(state/copy (atom 1)
            -a-)
@-a- => 1
raw docstring

createclj

(create class data)
(create class data opts)

creates a state of a particular type

((juxt deref type) (state/create clojure.lang.Atom 1)) => [1 clojure.lang.Atom]

creates a state of a particular type

((juxt deref type) (state/create clojure.lang.Atom 1))
=> [1 clojure.lang.Atom]
raw docstring

emptyclj

(empty obj)
(empty obj opts)

empties the state, extensible through the IStateSet protocol (let [a (atom 1)] (state/empty a) @a) => nil

empties the state, extensible through the IStateSet protocol
(let [a (atom 1)]
  (state/empty a)
  @a) => nil
raw docstring

getclj

(get obj)
(get obj opts)

Like deref but is extensible through the IStateGet protocol

(state/get (atom 1)) => 1

(state/get (ref 1)) => 1

Like deref but is extensible through the IStateGet protocol

(state/get (atom 1)) => 1

(state/get (ref 1)) => 1
raw docstring

list-typesclj

(list-types)

lists all types of state-like objects

(state/list-types) ;; (:ref :promise :agent :cache :var :volatile :atom) => seq?

lists all types of state-like objects

(state/list-types)
;; (:ref :promise :agent :cache :var :volatile :atom)
=> seq?
raw docstring

setclj

(set obj v)
(set obj v opts)

Like reset! but is extensible through the IStateSet protocol

(let [a (atom nil)] (state/set a 1) @a) => 1

Like reset! but is extensible through the IStateSet protocol

(let [a (atom nil)]
  (state/set a 1)
  @a) => 1
raw docstring

updateclj

(update obj f)
(update obj f & args)

Like swap! but is extensible through the IStateSet protocol

(let [a (atom 0)] (state/update a + 1) @a) => 1

Like swap! but is extensible through the IStateSet protocol

(let [a (atom 0)]
  (state/update a + 1)
  @a) => 1

raw docstring

update-applyclj

(update-apply obj f args)
(update-apply obj f args opts)

Like swap! but is extensible through the IStateSet protocol

(let [a (atom 0)] (state/update-apply a + [1 2 3]) @a) => 6

Like swap! but is extensible through the IStateSet protocol

(let [a (atom 0)]
  (state/update-apply a + [1 2 3])
  @a) => 6

raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close