Conversation

immutable data structures are so frustrating to work with because instead of doing something like this:

data["foo"]["bar"]["baz"] += 1

you have to do this:

new_value = data["foo"]["bar"]["baz"] + 1

data = data.set("foo",
    data["foo"].set("bar",
        data["bar"].set("baz", new_value)
    )
)
2
0
0

mx @kasdeya, this one is so sad to tell you that this is one of the features that this one likes from Common Lisp. (setf (get-baz (get-bar (get-foo data))) new-value).

0
0
0

@kasdeya haskell gets around this with lenses which are honestly really nice

1
0
1

@kasdeya data & foo & bar %~ (+ 1)

0
0
1