(const-setter s _)
The constant setter, returns the state unaltered.
The constant setter, returns the state unaltered.
(derive lens src)
(derive lens
src
{:keys [read-only? equals?] :or {read-only? false equals? identical?}})
Create a derived atom from an other atom with the provided lense.
The returned atom is lazy, so no code is executed until user requires it.
By default the derived atom does not trigger updates if the data
does not affects to it (determined by lense), but this behavior can
be deactivated passing :equals?
to false
on the third options
parameter. You also may pass =
as equals?
parameter if you want
value comparison instead of reference comparison with identical?
.
You can create expliclitly read only refs (not atoms, because the
returned object satisifies watchable and ref but not atom interface)
passing :read-only?
as true
as option on the optional third
parameter.
Create a derived atom from an other atom with the provided lense. The returned atom is lazy, so no code is executed until user requires it. By default the derived atom does not trigger updates if the data does not affects to it (determined by lense), but this behavior can be deactivated passing `:equals?` to `false` on the third options parameter. You also may pass `=` as `equals?` parameter if you want value comparison instead of reference comparison with `identical?`. You can create expliclitly read only refs (not atoms, because the returned object satisifies watchable and ref but not atom interface) passing `:read-only?` as `true` as option on the optional third parameter.
(focus lens s)
Given a lens and a state, return the value focused by the lens.
Given a lens and a state, return the value focused by the lens.
(id-setter s f)
The identity setter, applies the function to the state.
The identity setter, applies the function to the state.
(in path)
(in path default)
Given a path and optionally a default value, return a lens that focuses the given path in an associative data structure.
Given a path and optionally a default value, return a lens that focuses the given path in an associative data structure.
(key k)
Given a key, returns a lens that focuses on the given key of an associative data structure.
Given a key, returns a lens that focuses on the given key of an associative data structure.
(lens getter)
(lens getter setter)
Given a function for getting the focused value from a state (getter) and a function that takes the state and and update function (setter), constructs a lens.
Given a function for getting the focused value from a state (getter) and a function that takes the state and and update function (setter), constructs a lens.
(nth n)
Given a number, returns a lens that focuses on the given index of a collection.
Given a number, returns a lens that focuses on the given index of a collection.
(over st f s)
Given a setter, a function and a state, apply the function over the value focused by the setter.
Given a setter, a function and a state, apply the function over the value focused by the setter.
(passes applies?)
Given a predicate, return a lens that focuses in an element only if passes the predicate.
The lens is not well-behaved, depens on the outcome of the predicate.
Given a predicate, return a lens that focuses in an element only if passes the predicate. The lens is not well-behaved, depens on the outcome of the predicate.
(put st v s)
Given a setter, a new value and a state, replace the value focused by the lens with the new one.
Given a setter, a new value and a state, replace the value focused by the lens with the new one.
(select-keys ks)
Return a lens focused on the given keys in an associative data structure.
Return a lens focused on the given keys in an associative data structure.
(units one->other other->one)
Given a function from unit A to unit B and another in the opposite direction, construct a lens that focuses and updates a converted value.
Given a function from unit A to unit B and another in the opposite direction, construct a lens that focuses and updates a converted value.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close