News for hackers. Stuff that matters.
Re:Copying data is wasteful, mutating data is dangerous by eyelidlessness on Thursday January 09, 2020 @02:23PM (#22004538)
This definitely made me think of Clojure transients. For reference: https://clojure.org/reference/transients

> If a pure function mutates some local data in order to produce an immutable return value, is that ok?

The idea in Clojure is that data is immutable by default but there are function-local mutation APIs specifically for optimization. The contract between caller and callee is still the same, a function never mutates your data, but transients provide improved performance and memory characteristics invisible to the caller.

There are no comments on this comment yet.