Liking cljdoc? Tell your friends :D

com.rpl.specter


ALLclj/s

Navigate to every element of the collection. For maps navigates to a vector of [key value].

Navigate to every element of the collection. For maps navigates to
a vector of `[key value]`.
sourceraw docstring

ATOMclj/s

Navigates to atom value.

Navigates to atom value.
sourceraw docstring

BEGINNINGclj/s

Navigate to the empty subsequence before the first element of the collection.

Navigate to the empty subsequence before the first element of the collection.
sourceraw docstring

codewalkerclj/s

Like walker but maintains metadata of any forms traversed.

Like `walker` but maintains metadata of any forms traversed.
sourceraw docstring

collectclj/s

Adds the result of running select with the given path on the current value to the collected vals.

Adds the result of running select with the given path on the
current value to the collected vals.
sourceraw docstring

collect-oneclj/s

Adds the result of running select-one with the given path on the current value to the collected vals.

Adds the result of running select-one with the given path on the
current value to the collected vals.
sourceraw docstring

collected?clj/smacro

(collected? params & body)

Creates a filter function navigator that takes in all the collected values as input. For arguments, can use (collected? [a b] ...) syntax to look at each collected value as individual arguments, or (collected? v ...) syntax to capture all the collected values as a single vector.

Creates a filter function navigator that takes in all the collected values
as input. For arguments, can use `(collected? [a b] ...)` syntax to look
at each collected value as individual arguments, or `(collected? v ...)` syntax
to capture all the collected values as a single vector.
sourceraw docstring

collectorclj/smacro

(collector params [_ [_ structure-sym] & body])
source

comp-pathsclj/s

(comp-paths & apath)

Returns a compiled version of the given path for use with compiled-{select/transform/setval/etc.} functions. This can compile navigators (defined with defnav) without their parameters, and the resulting compiled path will require parameters for all such navigators in the order in which they were declared.

Returns a compiled version of the given path for use with
compiled-{select/transform/setval/etc.} functions. This can compile navigators
(defined with `defnav`) without their parameters, and the resulting compiled
path will require parameters for all such navigators in the order in which
they were declared.
sourceraw docstring

compiled-multi-transformclj/s

Version of multi-transform that takes in a path precompiled with comp-paths

Version of `multi-transform` that takes in a path precompiled with `comp-paths`
sourceraw docstring

compiled-replace-inclj/s

Version of replace-in that takes in a path precompiled with comp-paths

Version of replace-in that takes in a path precompiled with comp-paths
sourceraw docstring

compiled-selectclj/s

Version of select that takes in a path precompiled with comp-paths

Version of select that takes in a path precompiled with comp-paths
sourceraw docstring

compiled-select-anyclj/s

Version of select-any that takes in a path precompiled with comp-paths

Version of select-any that takes in a path precompiled with comp-paths
sourceraw docstring

compiled-select-firstclj/s

Version of select-first that takes in a path precompiled with comp-paths

Version of select-first that takes in a path precompiled with comp-paths
sourceraw docstring

compiled-select-oneclj/s

Version of select-one that takes in a path precompiled with comp-paths

Version of select-one that takes in a path precompiled with comp-paths
sourceraw docstring

compiled-select-one!clj/s

Version of select-one! that takes in a path precompiled with comp-paths

Version of select-one! that takes in a path precompiled with comp-paths
sourceraw docstring

compiled-selected-any?clj/s

Version of selected-any? that takes in a path precompiled with comp-paths

Version of selected-any? that takes in a path precompiled with comp-paths
sourceraw docstring

compiled-setvalclj/s

Version of setval that takes in a path precompiled with comp-paths

Version of setval that takes in a path precompiled with comp-paths
sourceraw docstring

compiled-transformclj/s

Version of transform that takes in a path precompiled with comp-paths

Version of transform that takes in a path precompiled with comp-paths
sourceraw docstring

compiled-traverseclj/s

Version of traverse that takes in a path precompiled with comp-paths

Version of traverse that takes in a path precompiled with comp-paths
sourceraw docstring

cond-pathclj/s

Takes in alternating cond-path path cond-path path... Tests the structure if selecting with cond-path returns anything. If so, it uses the following path for this portion of the navigation. Otherwise, it tries the next cond-path. If nothing matches, then the structure is not selected.

The input paths may be parameterized, in which case the result of cond-path will be parameterized in the order of which the parameterized navigators were declared.

Takes in alternating cond-path path cond-path path...
Tests the structure if selecting with cond-path returns anything.
If so, it uses the following path for this portion of the navigation.
Otherwise, it tries the next cond-path. If nothing matches, then the structure
is not selected.

The input paths may be parameterized, in which case the result of cond-path
will be parameterized in the order of which the parameterized navigators
were declared.
sourceraw docstring

continue-then-stayclj/s

Navigates to the provided path and then to the current element. This can be used to implement post-order traversal.

Navigates to the provided path and then to the current element. This can be used
to implement post-order traversal.
sourceraw docstring

continuous-subseqsclj/s

Navigates to every continuous subsequence of elements matching pred

Navigates to every continuous subsequence of elements matching `pred`
sourceraw docstring

declarepathclj/smacro

(declarepath name)
source

defcollectorclj/smacro

(defcollector name & body)
source

defdynamicnavclj/smacro

(defdynamicnav name & args)

Defines a function that can choose what navigator to use at runtime based on the dynamic context. The arguments will either be static values or objects satisfying dynamic-param?. Use late-bound-nav to produce a runtime navigator that uses the values of the dynamic params. See selected? for an illustrative example of dynamic navs.

Defines a function that can choose what navigator to use at runtime based on
the dynamic context. The arguments will either be static values or
objects satisfying `dynamic-param?`. Use `late-bound-nav` to produce a runtime
navigator that uses the values of the dynamic params. See `selected?` for
an illustrative example of dynamic navs.
sourceraw docstring

defmacroaliasclj/smacro

(defmacroalias name target)
source

defnavclj/smacro

source

defprotocolpathclj/smacro

(defprotocolpath name)
(defprotocolpath name params)

Defines a navigator that chooses the path to take based on the type of the value at the current point. May be specified with parameters to specify that all extensions must require that number of parameters.

Currently not available for ClojureScript.

Example of usage: (defrecord SingleAccount [funds]) (defrecord FamilyAccount [single-accounts])

(defprotocolpath FundsPath) (extend-protocolpath FundsPath SingleAccount :funds FamilyAccount [ALL FundsPath] )

Defines a navigator that chooses the path to take based on the type
of the value at the current point. May be specified with parameters to
specify that all extensions must require that number of parameters.

Currently not available for ClojureScript.

Example of usage:
(defrecord SingleAccount [funds])
(defrecord FamilyAccount [single-accounts])

(defprotocolpath FundsPath)
(extend-protocolpath FundsPath
  SingleAccount :funds
  FamilyAccount [ALL FundsPath]
  )
sourceraw docstring

defrichnavclj/smacro

(defrichnav name params & impls)
source

DISPENSEclj/s

Drops all collected values for subsequent navigation.

Drops all collected values for subsequent navigation.
sourceraw docstring

dynamic-param?clj/s

source

dynamicnavclj/smacro

(dynamicnav & args)
source

ENDclj/s

Navigate to the empty subsequence after the last element of the collection.

Navigate to the empty subsequence after the last element of the collection.
sourceraw docstring

extend-protocolpathclj/smacro

(extend-protocolpath protpath & extensions)

Used in conjunction with defprotocolpath. See defprotocolpath.

Used in conjunction with `defprotocolpath`. See [[defprotocolpath]].
sourceraw docstring

extend-protocolpath*clj

(extend-protocolpath* protpath-prot extensions)
source

filtererclj/s

Navigates to a view of the current sequence that only contains elements that match the given path. An element matches the selector path if calling select on that element with the path yields anything other than an empty sequence.

The input path may be parameterized, in which case the result of filterer will be parameterized in the order of which the parameterized selectors were declared.

Navigates to a view of the current sequence that only contains elements that
match the given path. An element matches the selector path if calling select
on that element with the path yields anything other than an empty sequence.

 The input path may be parameterized, in which case the result of filterer
 will be parameterized in the order of which the parameterized selectors
 were declared.
sourceraw docstring

FIRSTclj/s

Navigate to the first element of the collection. If the collection is empty navigation is stopped at this point.

Navigate to the first element of the collection. If the collection is
empty navigation is stopped at this point.
sourceraw docstring

if-pathclj/s

Like cond-path, but with if semantics.

Like cond-path, but with if semantics.
sourceraw docstring

keypathclj/s

Navigates to the specified key, navigating to nil if it does not exist.

Navigates to the specified key, navigating to nil if it does not exist.
sourceraw docstring

LASTclj/s

Navigate to the last element of the collection. If the collection is empty navigation is stopped at this point.

Navigate to the last element of the collection. If the collection is
empty navigation is stopped at this point.
sourceraw docstring

late-bound-collectorclj/smacro

(late-bound-collector bindings impl)
source

late-bound-navclj/smacro

(late-bound-nav bindings & impls)
source

late-bound-richnavclj/smacro

(late-bound-richnav bindings & impls)
source

late-pathclj/s

source

local-declarepathclj/s

source

MAP-VALSclj/s

Navigate to each value of the map. This is more efficient than navigating via [ALL LAST]

Navigate to each value of the map. This is more efficient than
navigating via [ALL LAST]
sourceraw docstring

METAclj/s

Navigates to the metadata of the structure, or nil if the structure has no metadata or may not contain metadata.

Navigates to the metadata of the structure, or nil if
the structure has no metadata or may not contain metadata.
sourceraw docstring

multi-pathclj/s

A path that branches on multiple paths. For updates, applies updates to the paths in order.

A path that branches on multiple paths. For updates,
applies updates to the paths in order.
sourceraw docstring

multi-transformclj/smacro

(multi-transform apath structure)

Just like transform but expects transform functions to be specified inline in the path using terminal. Error is thrown if navigation finishes at a non-terminal navigator. terminal-val is a wrapper around terminal and is the multi-transform equivalent of setval. This macro will do inline caching of the path.

Just like `transform` but expects transform functions to be specified
inline in the path using `terminal`. Error is thrown if navigation finishes
at a non-`terminal` navigator. `terminal-val` is a wrapper around `terminal` and is
the `multi-transform` equivalent of `setval`.
This macro will do inline caching of the path.
sourceraw docstring

multi-transform*clj/s

(multi-transform* path structure)

Just like transform but expects transform functions to be specified inline in the path using terminal. Error is thrown if navigation finishes at a non-terminal navigator. terminal-val is a wrapper around terminal and is the multi-transform equivalent of setval.

Just like `transform` but expects transform functions to be specified
inline in the path using `terminal`. Error is thrown if navigation finishes
at a non-`terminal` navigator. `terminal-val` is a wrapper around `terminal` and is
the `multi-transform` equivalent of `setval`.
sourceraw docstring

mustclj/s

Navigates to the key only if it exists in the map.

Navigates to the key only if it exists in the map.
sourceraw docstring

source

NIL->LISTclj/s

Navigates to '() if the value is nil. Otherwise it stays navigated at the current value.

Navigates to '() if the value is nil. Otherwise it stays
navigated at the current value.
sourceraw docstring

NIL->SETclj/s

Navigates to #{} if the value is nil. Otherwise it stays navigated at the current value.

Navigates to #{} if the value is nil. Otherwise it stays
navigated at the current value.
sourceraw docstring

nil->valclj/s

Navigates to the provided val if the structure is nil. Otherwise it stays navigated at the structure.

Navigates to the provided val if the structure is nil. Otherwise it stays
navigated at the structure.
sourceraw docstring

NIL->VECTORclj/s

Navigates to [] if the value is nil. Otherwise it stays navigated at the current value.

Navigates to [] if the value is nil. Otherwise it stays
navigated at the current value.
sourceraw docstring

NONEclj/s

Global value used to indicate no elements selected during select-any.

Global value used to indicate no elements selected during
[[select-any]].
sourceraw docstring

not-selected?clj/s

source

parserclj/s

Navigate to the result of running parse-fn on the value. For transforms, the transformed value then has unparse-fn run on it to get the final value at this point.

Navigate to the result of running `parse-fn` on the value. For
transforms, the transformed value then has `unparse-fn` run on
it to get the final value at this point.
sourceraw docstring

pathclj/smacro

(path & path)

Same as calling comp-paths, except it caches the composition of the static parts of the path for later re-use (when possible). For almost all idiomatic uses of Specter provides huge speedup. This macro is automatically used by the select/transform/setval/replace-in/etc. macros.

Same as calling comp-paths, except it caches the composition of the static parts
of the path for later re-use (when possible). For almost all idiomatic uses
of Specter provides huge speedup. This macro is automatically used by the
select/transform/setval/replace-in/etc. macros.
sourceraw docstring

predclj/s

Keeps the element only if it matches the supplied predicate. This is the late-bound parameterized version of using a function directly in a path.

Keeps the element only if it matches the supplied predicate. This is the
late-bound parameterized version of using a function directly in a path.
sourceraw docstring

providepathclj/smacro

(providepath name apath)
source

putvalclj/s

Adds an external value to the collected vals. Useful when additional arguments are required to the transform function that would otherwise require partial application or a wrapper function.

e.g., incrementing val at path [:a :b] by 3: (transform [:a :b (putval 3)] + some-map)

Adds an external value to the collected vals. Useful when additional arguments
are required to the transform function that would otherwise require partial
application or a wrapper function.

e.g., incrementing val at path [:a :b] by 3:
(transform [:a :b (putval 3)] + some-map)
sourceraw docstring

recursive-pathclj/smacro

(recursive-path params self-sym path)
source

replace-inclj/smacro

(replace-in apath transform-fn structure & args)

Similar to transform, except returns a pair of [transformed-structure sequence-of-user-ret]. The transform-fn in this case is expected to return [ret user-ret]. ret is what's used to transform the data structure, while user-ret will be added to the user-ret sequence in the final return. replace-in is useful for situations where you need to know the specific values of what was transformed in the data structure. This macro will do inline caching of the path.

Similar to transform, except returns a pair of [transformed-structure sequence-of-user-ret].
The transform-fn in this case is expected to return [ret user-ret]. ret is
what's used to transform the data structure, while user-ret will be added to the user-ret sequence
in the final return. replace-in is useful for situations where you need to know the specific values
of what was transformed in the data structure.
This macro will do inline caching of the path.
sourceraw docstring

replace-in*clj/s

(replace-in* path
             transform-fn
             structure
             &
             {:keys [merge-fn] :or {merge-fn concat}})

Similar to transform, except returns a pair of [transformed-structure sequence-of-user-ret]. The transform-fn in this case is expected to return [ret user-ret]. ret is what's used to transform the data structure, while user-ret will be added to the user-ret sequence in the final return. replace-in is useful for situations where you need to know the specific values of what was transformed in the data structure.

Similar to transform, except returns a pair of [transformed-structure sequence-of-user-ret].
The transform-fn in this case is expected to return [ret user-ret]. ret is
what's used to transform the data structure, while user-ret will be added to the user-ret sequence
in the final return. replace-in is useful for situations where you need to know the specific values
of what was transformed in the data structure.
sourceraw docstring

richnavclj/smacro

source

selectclj/smacro

(select apath structure)

Navigates to and returns a sequence of all the elements specified by the path. This macro will do inline caching of the path.

Navigates to and returns a sequence of all the elements specified by the path.
This macro will do inline caching of the path.
sourceraw docstring

select*clj/s

(select* path structure)

Navigates to and returns a sequence of all the elements specified by the path.

Navigates to and returns a sequence of all the elements specified by the path.
sourceraw docstring

select-anyclj/smacro

(select-any apath structure)

Returns any element found or NONE if nothing selected. This is the most efficient of the various selection operations. This macro will do inline caching of the path.

Returns any element found or [[NONE]] if nothing selected. This is the most
efficient of the various selection operations.
This macro will do inline caching of the path.
sourceraw docstring

select-any*clj/s

(select-any* path structure)

Returns any element found or NONE if nothing selected. This is the most efficient of the various selection operations.

Returns any element found or [[NONE]] if nothing selected. This is the most
efficient of the various selection operations.
sourceraw docstring

select-firstclj/smacro

(select-first apath structure)

Returns first element found. This macro will do inline caching of the path.

Returns first element found.
This macro will do inline caching of the path.
sourceraw docstring

select-first*clj/s

(select-first* path structure)

Returns first element found.

Returns first element found.
sourceraw docstring

select-oneclj/smacro

(select-one apath structure)

Like select, but returns either one element or nil. Throws exception if multiple elements found. This macro will do inline caching of the path.

Like select, but returns either one element or nil. Throws exception if multiple elements found.
This macro will do inline caching of the path.
sourceraw docstring

select-one!clj/smacro

(select-one! apath structure)

Returns exactly one element, throws exception if zero or multiple elements found. This macro will do inline caching of the path.

Returns exactly one element, throws exception if zero or multiple elements found.
This macro will do inline caching of the path.
sourceraw docstring

select-one!*clj/s

(select-one!* path structure)

Returns exactly one element, throws exception if zero or multiple elements found

Returns exactly one element, throws exception if zero or multiple elements found
sourceraw docstring

select-one*clj/s

(select-one* path structure)

Like select, but returns either one element or nil. Throws exception if multiple elements found

Like select, but returns either one element or nil. Throws exception if multiple elements found
sourceraw docstring

selected-any?clj/smacro

(selected-any? apath structure)

Returns true if any element was selected, false otherwise. This macro will do inline caching of the path.

Returns true if any element was selected, false otherwise.
This macro will do inline caching of the path.
sourceraw docstring

selected-any?*clj/s

(selected-any?* path structure)

Returns true if any element was selected, false otherwise.

Returns true if any element was selected, false otherwise.
sourceraw docstring

selected?clj/s

Filters the current value based on whether a path finds anything. e.g. (selected? :vals ALL even?) keeps the current element only if an even number exists for the :vals key.

Filters the current value based on whether a path finds anything.
e.g. (selected? :vals ALL even?) keeps the current element only if an
even number exists for the :vals key.
sourceraw docstring

setvalclj/smacro

(setval apath aval structure)

Navigates to each value specified by the path and replaces it by aval. This macro will do inline caching of the path.

Navigates to each value specified by the path and replaces it by `aval`.
This macro will do inline caching of the path.
sourceraw docstring

setval*clj/s

(setval* path val structure)

Navigates to each value specified by the path and replaces it by val

Navigates to each value specified by the path and replaces it by val
sourceraw docstring

srangeclj/s

Navigates to the subsequence bound by the indexes start (inclusive) and end (exclusive)

Navigates to the subsequence bound by the indexes start (inclusive)
and end (exclusive)
sourceraw docstring

srange-dynamicclj/s

Uses start-fn and end-fn to determine the bounds of the subsequence to select when navigating. Each function takes in the structure as input.

Uses start-fn and end-fn to determine the bounds of the subsequence
to select when navigating. Each function takes in the structure as input.
sourceraw docstring

STAYclj/s

Stays navigated at the current point. Essentially a no-op navigator.

Stays navigated at the current point. Essentially a no-op navigator.
sourceraw docstring

stay-then-continueclj/s

Navigates to the current element and then navigates via the provided path. This can be used to implement pre-order traversal.

Navigates to the current element and then navigates via the provided path.
This can be used to implement pre-order traversal.
sourceraw docstring

STOPclj/s

Stops navigation at this point. For selection returns nothing and for transformation returns the structure unchanged

Stops navigation at this point. For selection returns nothing and for
transformation returns the structure unchanged
sourceraw docstring

submapclj/s

Navigates to the specified submap (using select-keys). In a transform, that submap in the original map is changed to the new value of the submap.

Navigates to the specified submap (using select-keys).
In a transform, that submap in the original map is changed to the new
value of the submap.
sourceraw docstring

subselectclj/s

Navigates to a sequence that contains the results of (select ...), but is a view to the original structure that can be transformed.

Requires that the input navigators will walk the structure's children in the same order when executed on "select" and then "transform".

Navigates to a sequence that contains the results of (select ...),
but is a view to the original structure that can be transformed.

Requires that the input navigators will walk the structure's
children in the same order when executed on "select" and then
"transform".
sourceraw docstring

subsetclj/s

Navigates to the specified subset (by taking an intersection). In a transform, that subset in the original set is changed to the new value of the subset.

Navigates to the specified subset (by taking an intersection).
In a transform, that subset in the original set is changed to the
new value of the subset.
sourceraw docstring

terminalclj/s

For usage with multi-transform, defines an endpoint in the navigation that will have the parameterized transform function run. The transform function works just like it does in transform, with collected values given as the first arguments

For usage with `multi-transform`, defines an endpoint in the navigation
that will have the parameterized transform function run. The transform
function works just like it does in `transform`, with collected values
given as the first arguments
sourceraw docstring

terminal-valclj/s

(terminal-val v)

Like terminal but specifies a val to set at the location regardless of the collected values or the value at the location.

Like `terminal` but specifies a val to set at the location regardless of
the collected values or the value at the location.
sourceraw docstring

transformclj/smacro

(transform apath transform-fn structure)

Navigates to each value specified by the path and replaces it by the result of running the transform-fn on it. This macro will do inline caching of the path.

Navigates to each value specified by the path and replaces it by the result of running
the transform-fn on it.
This macro will do inline caching of the path.
sourceraw docstring

transform*clj/s

(transform* path transform-fn structure)

Navigates to each value specified by the path and replaces it by the result of running the transform-fn on it

Navigates to each value specified by the path and replaces it by the result of running
the transform-fn on it
sourceraw docstring

transformedclj/s

Navigates to a view of the current value by transforming it with the specified path and update-fn.

The input path may be parameterized, in which case the result of transformed will be parameterized in the order of which the parameterized navigators were declared.

Navigates to a view of the current value by transforming it with the
specified path and update-fn.

The input path may be parameterized, in which case the result of transformed
will be parameterized in the order of which the parameterized navigators
were declared.
sourceraw docstring

traverseclj/smacro

(traverse apath structure)

Return a reducible object that traverses over structure to every element specified by the path. This macro will do inline caching of the path.

Return a reducible object that traverses over `structure` to every element
specified by the path.
This macro will do inline caching of the path.
sourceraw docstring

traverse*clj/s

(traverse* apath structure)

Return a reducible object that traverses over structure to every element specified by the path

Return a reducible object that traverses over `structure` to every element
specified by the path
sourceraw docstring

VALclj/s

source

viewclj/s

Navigates to result of running afn on the currently navigated value.

Navigates to result of running `afn` on the currently navigated value.
sourceraw docstring

walkerclj/s

Using clojure.walk, navigate the data structure until reaching a value for which afn returns truthy.

Using clojure.walk, navigate the data structure until reaching
a value for which `afn` returns truthy.
sourceraw docstring

with-inline-debugclj/smacro

(with-inline-debug & body)
source

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

× close