(reduce-cursor-in ref path reducer & {:as options})Given atom with deep nested value, path inside it and reducing function, creates an atom-like structure that can be used separately from main atom, but only for reading value:
(def state (atom {:users {"Ivan" {:children [1 2 3]}}})) (def ivan (citrus.cursor/reduce-cursor-in state [:users "Ivan" :children] last)) (deref ivan) ;; => 3
Returned value supports deref, watches and metadata.
The only supported option is :meta
Given atom with deep nested value, path inside it and reducing function, creates an atom-like structure
that can be used separately from main atom, but only for reading value:
(def state (atom {:users {"Ivan" {:children [1 2 3]}}}))
(def ivan (citrus.cursor/reduce-cursor-in state [:users "Ivan" :children] last))
(deref ivan) ;; => 3
Returned value supports deref, watches and metadata.
The only supported option is `:meta`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 |