11 ms·
> so instead of having a mutable set, we have a mutable variable that points to a new immutable version of the set This is not at all how functional data struc
by hellofunk 9y ago
> so instead of having a mutable set, we have a mutable variable that points to a new immutable version of the set
This is not at all how functional data structures work. You're assuming that the data structures are the same as non-functional data structures, but merely without the ability to mutate them. That is not correct. Proper functional data structures are implemented completely differently.
One obvious exception to this is the Swift language, which is not really a functional programming language, and it does not have functional data structures. It uses copy-on-write which is somewhat similar to what you describe, but is not how functional programming languages do it.