104 lines
No EOL
33 KiB
HTML
104 lines
No EOL
33 KiB
HTML
<!DOCTYPE html PUBLIC ""
|
|
"">
|
|
<html><head><meta charset="UTF-8" /><link href="css/default.css" rel="stylesheet" type="text/css" /><script src="js/jquery.min.js" type="text/javascript"></script><script src="js/page_effects.js" type="text/javascript"></script><title>com.rpl.specter documentation</title></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Specter</span> <span class="project-version">0.11.1</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>com</span></div></div></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>rpl</span></div></div></li><li class="depth-3 current"><a href="com.rpl.specter.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>specter</span></div></a></li><li class="depth-4 branch"><a href="com.rpl.specter.macros.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>macros</span></div></a></li><li class="depth-4 branch"><a href="com.rpl.specter.protocols.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>protocols</span></div></a></li><li class="depth-4 branch"><a href="com.rpl.specter.transient.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>transient</span></div></a></li><li class="depth-4"><a href="com.rpl.specter.zipper.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>zipper</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="com.rpl.specter.html#var-ALL"><div class="inner"><span>ALL</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-ATOM"><div class="inner"><span>ATOM</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-BEGINNING"><div class="inner"><span>BEGINNING</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-bind-params*"><div class="inner"><span>bind-params*</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-codewalker"><div class="inner"><span>codewalker</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-collect"><div class="inner"><span>collect</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-collect-one"><div class="inner"><span>collect-one</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-comp-paths"><div class="inner"><span>comp-paths</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-compiled-replace-in"><div class="inner"><span>compiled-replace-in</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-compiled-select"><div class="inner"><span>compiled-select</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-compiled-select-first"><div class="inner"><span>compiled-select-first</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-compiled-select-one"><div class="inner"><span>compiled-select-one</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-compiled-select-one.21"><div class="inner"><span>compiled-select-one!</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-compiled-setval"><div class="inner"><span>compiled-setval</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-compiled-transform"><div class="inner"><span>compiled-transform</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-cond-path"><div class="inner"><span>cond-path</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-continue-then-stay"><div class="inner"><span>continue-then-stay</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-continuous-subseqs"><div class="inner"><span>continuous-subseqs</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-END"><div class="inner"><span>END</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-filterer"><div class="inner"><span>filterer</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-FIRST"><div class="inner"><span>FIRST</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-if-path"><div class="inner"><span>if-path</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-keypath"><div class="inner"><span>keypath</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-LAST"><div class="inner"><span>LAST</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-MAP-VALS"><div class="inner"><span>MAP-VALS</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-multi-path"><div class="inner"><span>multi-path</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-must"><div class="inner"><span>must</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-must-cache-paths.21"><div class="inner"><span>must-cache-paths!</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-NIL-.3ELIST"><div class="inner"><span>NIL->LIST</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-NIL-.3ESET"><div class="inner"><span>NIL->SET</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-nil-.3Eval"><div class="inner"><span>nil->val</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-NIL-.3EVECTOR"><div class="inner"><span>NIL->VECTOR</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-not-selected.3F"><div class="inner"><span>not-selected?</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-params-reset"><div class="inner"><span>params-reset</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-parser"><div class="inner"><span>parser</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-pred"><div class="inner"><span>pred</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-putval"><div class="inner"><span>putval</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-replace-in*"><div class="inner"><span>replace-in*</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-select*"><div class="inner"><span>select*</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-select-first*"><div class="inner"><span>select-first*</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-select-one.21*"><div class="inner"><span>select-one!*</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-select-one*"><div class="inner"><span>select-one*</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-selected.3F"><div class="inner"><span>selected?</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-setval*"><div class="inner"><span>setval*</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-srange"><div class="inner"><span>srange</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-srange-dynamic"><div class="inner"><span>srange-dynamic</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-STAY"><div class="inner"><span>STAY</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-stay-then-continue"><div class="inner"><span>stay-then-continue</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-STOP"><div class="inner"><span>STOP</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-submap"><div class="inner"><span>submap</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-subselect"><div class="inner"><span>subselect</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-subset"><div class="inner"><span>subset</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-transform*"><div class="inner"><span>transform*</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-transformed"><div class="inner"><span>transformed</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-VAL"><div class="inner"><span>VAL</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-view"><div class="inner"><span>view</span></div></a></li><li class="depth-1"><a href="com.rpl.specter.html#var-walker"><div class="inner"><span>walker</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">com.rpl.specter</h1><div class="doc"><pre class="plaintext"></pre></div><div class="public anchor" id="var-ALL"><h3>ALL</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Navigate to every element of the collection. For maps navigates to
|
|
a vector of `[key value]`.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L160">view source</a></div></div><div class="public anchor" id="var-ATOM"><h3>ATOM</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Navigates to atom value.
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L370">view source</a></div></div><div class="public anchor" id="var-BEGINNING"><h3>BEGINNING</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Navigate to the empty subsequence before the first element of the collection.
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L232">view source</a></div></div><div class="public anchor" id="var-bind-params*"><h3>bind-params*</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Takes a compiled path that needs late-bound params and supplies it with
|
|
an array of params and a position in the array from which to begin reading
|
|
params. The return value is an executable selector.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L117">view source</a></div></div><div class="public anchor" id="var-codewalker"><h3>codewalker</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Like `walker` but maintains metadata of any forms traversed.
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L295">view source</a></div></div><div class="public anchor" id="var-collect"><h3>collect</h3><div class="usage"><code>(collect & path)</code></div><div class="doc"><pre class="plaintext">Adds the result of running select with the given path on the
|
|
current value to the collected vals.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L501">view source</a></div></div><div class="public anchor" id="var-collect-one"><h3>collect-one</h3><div class="usage"><code>(collect-one & path)</code></div><div class="doc"><pre class="plaintext">Adds the result of running select-one with the given path on the
|
|
current value to the collected vals.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L511">view source</a></div></div><div class="public anchor" id="var-comp-paths"><h3>comp-paths</h3><div class="usage"><code>(comp-paths & apath)</code></div><div class="doc"><pre class="plaintext">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.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L26">view source</a></div></div><div class="public anchor" id="var-compiled-replace-in"><h3>compiled-replace-in</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Version of replace-in that takes in a path precompiled with comp-paths
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L103">view source</a></div></div><div class="public anchor" id="var-compiled-select"><h3>compiled-select</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Version of select that takes in a path precompiled with comp-paths
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L49">view source</a></div></div><div class="public anchor" id="var-compiled-select-first"><h3>compiled-select-first</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Version of select-first that takes in a path pre-compiled with comp-paths
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L74">view source</a></div></div><div class="public anchor" id="var-compiled-select-one"><h3>compiled-select-one</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Version of select-one that takes in a path pre-compiled with comp-paths
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L58">view source</a></div></div><div class="public anchor" id="var-compiled-select-one.21"><h3>compiled-select-one!</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Version of select-one! that takes in a path pre-compiled with comp-paths
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L66">view source</a></div></div><div class="public anchor" id="var-compiled-setval"><h3>compiled-setval</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Version of setval that takes in a path precompiled with comp-paths
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L95">view source</a></div></div><div class="public anchor" id="var-compiled-transform"><h3>compiled-transform</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Version of transform that takes in a path pre-compiled with comp-paths
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L86">view source</a></div></div><div class="public anchor" id="var-cond-path"><h3>cond-path</h3><div class="usage"><code>(cond-path & conds)</code></div><div class="doc"><pre class="plaintext">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.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L555">view source</a></div></div><div class="public anchor" id="var-continue-then-stay"><h3>continue-then-stay</h3><div class="usage"><code>(continue-then-stay & path)</code></div><div class="doc"><pre class="plaintext">Navigates to the provided path and then to the current element. This can be used
|
|
to implement post-order traversal.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L599">view source</a></div></div><div class="public anchor" id="var-continuous-subseqs"><h3>continuous-subseqs</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Navigates to every continuous subsequence of elements matching `pred`
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L214">view source</a></div></div><div class="public anchor" id="var-END"><h3>END</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Navigate to the empty subsequence after the last element of the collection.
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L243">view source</a></div></div><div class="public anchor" id="var-filterer"><h3>filterer</h3><div class="usage"><code>(filterer & path)</code></div><div class="doc"><pre class="plaintext">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.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L419">view source</a></div></div><div class="public anchor" id="var-FIRST"><h3>FIRST</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Navigate to the first element of the collection. If the collection is
|
|
empty navigation is stopped at this point.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L186">view source</a></div></div><div class="public anchor" id="var-if-path"><h3>if-path</h3><div class="usage"><code>(if-path cond-p then-path)</code><code>(if-path cond-p then-path else-path)</code></div><div class="doc"><pre class="plaintext">Like cond-path, but with if semantics.
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L534">view source</a></div></div><div class="public anchor" id="var-keypath"><h3>keypath</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Navigates to the specified key, navigating to nil if it does not exist.
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L325">view source</a></div></div><div class="public anchor" id="var-LAST"><h3>LAST</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Navigate to the last element of the collection. If the collection is
|
|
empty navigation is stopped at this point.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L180">view source</a></div></div><div class="public anchor" id="var-MAP-VALS"><h3>MAP-VALS</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Navigate to each value of the map. This is more efficient than
|
|
navigating via [ALL LAST]</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L166">view source</a></div></div><div class="public anchor" id="var-multi-path"><h3>multi-path</h3><div class="usage"><code>(multi-path & paths)</code></div><div class="doc"><pre class="plaintext">A path that branches on multiple paths. For updates,
|
|
applies updates to the paths in order.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L574">view source</a></div></div><div class="public anchor" id="var-must"><h3>must</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Navigates to the key only if it exists in the map.
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L335">view source</a></div></div><div class="public anchor" id="var-must-cache-paths.21"><h3>must-cache-paths!</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Mandate that operations that do inline path factoring and compilation
|
|
(select/transform/setval/replace-in/path/etc.) must succeed in
|
|
factoring the path into static and dynamic portions. If not, an
|
|
error will be thrown and the reasons for not being able to factor
|
|
will be printed. Defaults to false, and `(must-cache-paths! false)`
|
|
can be used to turn this feature off.
|
|
|
|
Reasons why it may not be able to factor a path include using
|
|
a local symbol, special form, or regular function invocation
|
|
where a navigator is expected.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L35">view source</a></div></div><div class="public anchor" id="var-NIL-.3ELIST"><h3>NIL->LIST</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Navigates to '() if the value is nil. Otherwise it stays
|
|
navigated at the current value.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L489">view source</a></div></div><div class="public anchor" id="var-NIL-.3ESET"><h3>NIL->SET</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Navigates to #{} if the value is nil. Otherwise it stays
|
|
navigated at the current value.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L483">view source</a></div></div><div class="public anchor" id="var-nil-.3Eval"><h3>nil->val</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Navigates to the provided val if the structure is nil. Otherwise it stays
|
|
navigated at the structure.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L473">view source</a></div></div><div class="public anchor" id="var-NIL-.3EVECTOR"><h3>NIL->VECTOR</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Navigates to [] if the value is nil. Otherwise it stays
|
|
navigated at the current value.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L495">view source</a></div></div><div class="public anchor" id="var-not-selected.3F"><h3>not-selected?</h3><div class="usage"><code>(not-selected? & path)</code></div><div class="doc"><pre class="plaintext"></pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L404">view source</a></div></div><div class="public anchor" id="var-params-reset"><h3>params-reset</h3><div class="usage"><code>(params-reset params-path)</code></div><div class="doc"><pre class="plaintext"></pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L122">view source</a></div></div><div class="public anchor" id="var-parser"><h3>parser</h3><div class="usage"></div><div class="doc"><pre class="plaintext">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.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L358">view source</a></div></div><div class="public anchor" id="var-pred"><h3>pred</h3><div class="usage"></div><div class="doc"><pre class="plaintext">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.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L466">view source</a></div></div><div class="public anchor" id="var-putval"><h3>putval</h3><div class="usage"></div><div class="doc"><pre class="plaintext">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)</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L521">view source</a></div></div><div class="public anchor" id="var-replace-in*"><h3>replace-in*</h3><div class="usage"><code>(replace-in* path transform-fn structure & {:keys [merge-fn], :or {merge-fn concat}})</code></div><div class="doc"><pre class="plaintext">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.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L106">view source</a></div></div><div class="public anchor" id="var-select*"><h3>select*</h3><div class="usage"><code>(select* path structure)</code></div><div class="doc"><pre class="plaintext">Navigates to and returns a sequence of all the elements specified by the path.
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L52">view source</a></div></div><div class="public anchor" id="var-select-first*"><h3>select-first*</h3><div class="usage"><code>(select-first* path structure)</code></div><div class="doc"><pre class="plaintext">Returns first element found. Not any more efficient than select, just a convenience
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L78">view source</a></div></div><div class="public anchor" id="var-select-one.21*"><h3>select-one!*</h3><div class="usage"><code>(select-one!* path structure)</code></div><div class="doc"><pre class="plaintext">Returns exactly one element, throws exception if zero or multiple elements found
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L69">view source</a></div></div><div class="public anchor" id="var-select-one*"><h3>select-one*</h3><div class="usage"><code>(select-one* path structure)</code></div><div class="doc"><pre class="plaintext">Like select, but returns either one element or nil. Throws exception if multiple elements found
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L61">view source</a></div></div><div class="public anchor" id="var-selected.3F"><h3>selected?</h3><div class="usage"><code>(selected? & path)</code></div><div class="doc"><pre class="plaintext">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.
|
|
|
|
The input path may be parameterized, in which case the result of selected?
|
|
will be parameterized in the order of which the parameterized navigators
|
|
were declared.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L381">view source</a></div></div><div class="public anchor" id="var-setval*"><h3>setval*</h3><div class="usage"><code>(setval* path val structure)</code></div><div class="doc"><pre class="plaintext">Navigates to each value specified by the path and replaces it by val
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L98">view source</a></div></div><div class="public anchor" id="var-srange"><h3>srange</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Navigates to the subsequence bound by the indexes start (inclusive)
|
|
and end (exclusive)</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L203">view source</a></div></div><div class="public anchor" id="var-srange-dynamic"><h3>srange-dynamic</h3><div class="usage"></div><div class="doc"><pre class="plaintext">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.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L192">view source</a></div></div><div class="public anchor" id="var-STAY"><h3>STAY</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Stays navigated at the current point. Essentially a no-op navigator.
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L151">view source</a></div></div><div class="public anchor" id="var-stay-then-continue"><h3>stay-then-continue</h3><div class="usage"><code>(stay-then-continue & path)</code></div><div class="doc"><pre class="plaintext">Navigates to the current element and then navigates via the provided path.
|
|
This can be used to implement pre-order traversal.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L593">view source</a></div></div><div class="public anchor" id="var-STOP"><h3>STOP</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Stops navigation at this point. For selection returns nothing and for
|
|
transformation returns the structure unchanged</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L140">view source</a></div></div><div class="public anchor" id="var-submap"><h3>submap</h3><div class="usage"></div><div class="doc"><pre class="plaintext">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.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L270">view source</a></div></div><div class="public anchor" id="var-subselect"><h3>subselect</h3><div class="usage"><code>(subselect & path)</code></div><div class="doc"><pre class="plaintext">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".</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L304">view source</a></div></div><div class="public anchor" id="var-subset"><h3>subset</h3><div class="usage"></div><div class="doc"><pre class="plaintext">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.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L254">view source</a></div></div><div class="public anchor" id="var-transform*"><h3>transform*</h3><div class="usage"><code>(transform* path transform-fn structure)</code></div><div class="doc"><pre class="plaintext">Navigates to each value specified by the path and replaces it by the result of running
|
|
the transform-fn on it</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L89">view source</a></div></div><div class="public anchor" id="var-transformed"><h3>transformed</h3><div class="usage"><code>(transformed path update-fn)</code></div><div class="doc"><pre class="plaintext">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.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L430">view source</a></div></div><div class="public anchor" id="var-VAL"><h3>VAL</h3><div class="usage"></div><div class="doc"><pre class="plaintext"></pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L178">view source</a></div></div><div class="public anchor" id="var-view"><h3>view</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Navigates to result of running `afn` on the currently navigated value.
|
|
</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L348">view source</a></div></div><div class="public anchor" id="var-walker"><h3>walker</h3><div class="usage"></div><div class="doc"><pre class="plaintext">Using clojure.walk, navigate the data structure until reaching
|
|
a value for which `afn` returns truthy.</pre></div><div class="src-link"><a href="https://github.com/nathanmarz/specter/tree/0.11.1/src/clj/com/rpl/specter.cljx#L285">view source</a></div></div></div></body></html> |