A collection of helper functions useful for updating and conditionally updating datastructures.
A collection of helper functions useful for updating and conditionally updating datastructures.
(->>when-update pred f & args)
Function of a predicate, an updater, optional varargs and a value. If the predicate is true of the value, returns (apply f x args), otherwise returns x.
Example: (->> 1 (->>when-update #(<= 0 %) inc))
Function of a predicate, an updater, optional varargs and a value. If the predicate is true of the value, returns (apply f x args), otherwise returns x. Example: (->> 1 (->>when-update #(<= 0 %) inc))
(->when-update x pred f & args)
Function of a value, a predicate, an updater and optional varargs. If the predicate is true of the value, returns (apply f x args), otherwise returns x.
Example: (-> 1 (->when-update #(<= 0 %) inc))
Function of a value, a predicate, an updater and optional varargs. If the predicate is true of the value, returns (apply f x args), otherwise returns x. Example: (-> 1 (->when-update #(<= 0 %) inc))
(fix f dat)
λ (fn T → T) → T → T
Eagerly computes the fixed point combinator of the input function and value. As this computation is eager, it will terminate only when a fixed point is reached which may be never.
λ (fn T → T) → T → T Eagerly computes the fixed point combinator of the input function and value. As this computation is eager, it will terminate only when a fixed point is reached which may be never.
Colloquial term for transforming the domain.
Colloquial term for transforming the domain.
(map-keys-and-vals m f & args)
Create a new map from m by calling function f on each key & each value to get a new key & value
Create a new map from m by calling function f on each key & each value to get a new key & value
Colloquial term for transforming the codomain.
Colloquial term for transforming the codomain.
(map-vals-with-keys m f & args)
Create a new map from m by calling function f, with two arguments (the key and value) to get a new value.
Create a new map from m by calling function f, with two arguments (the key and value) to get a new value.
(take-when f empty col)
Helper useful for parsing regular function argument seqeunces. If a predicate is satisfied, returns a pair [(first col), (rest col)] otherwise returns the pair [empty, col].
Ex. (let [[?docstring args] (take-when string? "" args) [?attr-map args] (take-when map? {} args)] ..)
Helper useful for parsing regular function argument seqeunces. If a predicate is satisfied, returns a pair [(first col), (rest col)] otherwise returns the pair [empty, col]. Ex. (let [[?docstring args] (take-when string? "" args) [?attr-map args] (take-when map? {} args)] ..)
(update-codomain m f & args)
Transforms a mapping (function) by applying the given transformation to all the elements of the codomain, returning a new mapping m' such that ∀k→v∈m, k→(f v & args)∈m'.
Transforms a mapping (function) by applying the given transformation to all the elements of the codomain, returning a new mapping m' such that ∀k→v∈m, k→(f v & args)∈m'.
(update-domain m f & args)
Transforms a mapping (function) by applying the given transformation to all the elements of the domain, returning a new mapping m' such that ∀k→v∈m, (f k & args)→v∈m'.
Transforms a mapping (function) by applying the given transformation to all the elements of the domain, returning a new mapping m' such that ∀k→v∈m, (f k & args)→v∈m'.
Colloquial term for transforming the domain.
Colloquial term for transforming the domain.
Colloquial term for transforming the codomain.
Colloquial term for transforming the codomain.
Colloquial term for transforming the codomain.
Colloquial term for transforming the codomain.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close