Protocol for applying updates through navigation structure
Protocol for applying updates through navigation structure
(apply-updates nav data f)(matches-when data pred)(matches-when data pred xf-or-opts)Scan a data structure for values matching the predicate.
Returns vector of matches or nil if no matches.
Supports transducers via :xf option for transformation and early termination.
Scan a data structure for values matching the predicate. Returns vector of matches or `nil` if no matches. Supports transducers via `:xf` option for transformation and early termination.
Sentinel value that signals removal of an element from its parent collection.
Return this from an update-paths transform function to remove the element.
Behavior by collection type:
dissoc)Example:
(transform-when data number? #(if (neg? %) REMOVE (inc %)))
;; Removes negative numbers, increments positive ones
Sentinel value that signals removal of an element from its parent collection. Return this from an `update-paths` transform function to remove the element. Behavior by collection type: - Maps: the key-value pair is removed (`dissoc`) - Sets: the element is not added to the result - Vectors/Lists: the element is removed and indices collapse Example: ```clojure (transform-when data number? #(if (neg? %) REMOVE (inc %))) ;; Removes negative numbers, increments positive ones ```
(path-when this matches pred opts)Scan for matches, building navigation.
Scan for matches, building navigation.
(scan-when this add-match pred opts)Scan for matches without navigation. Returns true if stopped early.
Scan for matches without navigation. Returns true if stopped early.
(vec-remove-indices* v indices cast)(vec-remove-indices* v indices cast metadata)Remove elements at specified indices from a vector using subvec splicing.
Arguments:
v: the source vectorindices: an accumulator (ArrayList) of indices to remove, or nil for no removalscast: function to convert the result (e.g., accumulator->vec)metadata: optional metadata to attach to the resultConstraints (not validated - caller must ensure):
[0, (dec (count v))]Remove elements at specified indices from a vector using subvec splicing. Arguments: - `v`: the source vector - `indices`: an accumulator (ArrayList) of indices to remove, or nil for no removals - `cast`: function to convert the result (e.g., `accumulator->vec`) - `metadata`: optional metadata to attach to the result Constraints (not validated - caller must ensure): - indices must be sorted in ascending order - indices must be unique (no duplicates) - indices must be within bounds `[0, (dec (count v))]`
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |