Liking cljdoc? Tell your friends :D

lentes.core


const-setterclj/s

(const-setter s _)

The constant setter, returns the state unaltered.

The constant setter, returns the state unaltered.
sourceraw docstring

deriveclj/s

(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.
sourceraw docstring

focusclj/s

(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.
sourceraw docstring

fstclj/s

source

idclj/s

Identity lens.

Identity lens.
sourceraw docstring

id-setterclj/s

(id-setter s f)

The identity setter, applies the function to the state.

The identity setter, applies the function to the state.
sourceraw docstring

inclj/s

(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.
sourceraw docstring

keyclj/s

(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.
sourceraw docstring

lensclj/s

(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.
sourceraw docstring

nthclj/s

(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.
sourceraw docstring

overclj/s

(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.
sourceraw docstring

passesclj/s

(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.
sourceraw docstring

putclj/s

(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.
sourceraw docstring

select-keysclj/s

(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.
sourceraw docstring

sndclj/s

source

tailclj/s

A lens into the tail of a collection.

A lens into the tail of a collection.
sourceraw docstring

unitsclj/s

(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.
sourceraw docstring

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

× close