4 ms·
You can pretty efficiently do this in Clojure (update-in {:foo [{:bar ["a"], :baz ["b" "c" "d"]}]} [:foo 0 :baz 1] clojure.string/capitalize
by joshlemer 5y ago
You can pretty efficiently do this in Clojure
(update-in
{:foo [{:bar ["a"], :baz ["b" "c" "d"]}]}
[:foo 0 :baz 1]
clojure.string/capitalize)
;; => {:foo [{:bar ["a"], :baz ["b" "C" "d"]}]}
- tomp 5y agoThis only works if you know what to edit up-front. If you're processing a tree-like structure via recursion (e.g. type-checking an AST implemented with persistent immutable structures in a compiler) it's no longer easy.