2 ms·
But I've done a bit of Clojure, and I've done a bit of Immutable.js, and particularly when you have a deeply-structured piece of data, "mutating" something a fe
by Scarbutt 7y ago
But I've done a bit of Clojure, and I've done a bit of Immutable.js, and particularly when you have a deeply-structured piece of data, "mutating" something a few levels down gets really ugly.
As opposed to what languages?
- _bxg1 7y ago(assoc foo "bar" (assoc (get foo "bar") "alice" (assoc (get (get foo "bar") "alice") "bob" 12))) vs foo.bar.alice.bob = 12;
- Scarbutt 7y ago(assoc-in foo ["bar" "alice" "bob"] 12) Of course, in clojure you mostly use :keywords instead "strings" as keys which has a ton of benefits. There's also specter if want something more powerful at the cost of an additional lib. https://github.com/nathanmarz/specter https://github.com/nathanmarz/specter https://www.youtube.com/watch?v=rh5J4vacG98 https://www.youtube.com/watch?v=rh5J4vacG98