2 ms·
I think a lot of the pain in Scala/Rust etc immutable data structures comes down to static typing. In Clojure for instance you can very ergonomically do deeply
by joshlemer 5y ago
I think a lot of the pain in Scala/Rust etc immutable data structures comes down to static typing. In Clojure for instance you can very ergonomically do deeply nested persistent updates.
(update-in
{:foo [{:bar ["a"] :baz ["b" "c" "d"]}]}
[:foo 0 :baz 1]
clojure.string/capitalize)
=> {:foo [{:bar ["a"], :baz ["b" "C" "d"]}]}
- mbrodersen 5y agoIn Haskell you can you Lenses to easily manipulate sub-trees, individual values, or a selection of values in tree like data structures. It is very powerful.