The key idea is that there are functional data structures that only require you to copy a small part and reuse a lot of the old. For example, if you have a binary tree and you want to swap out the root value, you create a new root node that simply uses the existing children.
>So, deep down in the guts of the language's libraries there must be mutable operations. Which kind of defeats the whole point.
Why does it defeat the point? If you can guarantee that the mutability doesn't leak (there are ways to do this), it behaves just like a pure implementation.
>So, deep down in the guts of the language's libraries there must be mutable operations. Which kind of defeats the whole point.
Why does it defeat the point? If you can guarantee that the mutability doesn't leak (there are ways to do this), it behaves just like a pure implementation.