Re:Why Functional Programming Should Be the Future of Software
by AnimalMuppet on Wednesday November 02, 2022 @02:45PM
(#33440947)
But if you modify the leaf, don't you also have to modify the branch node that points to the leaf, so that it points to the new one? And every node from there to the root?
[ Parent
| on HN ]
Re:Why Functional Programming Should Be the Future of Software
by hither_shores on Wednesday November 02, 2022 @03:46PM
(#33441907)
Yes, you (or rather, core library developers) need to pick a data structure appropriate to your access patterns: linked lists for iteration, search trees for concatenation, finger trees for random access, and so on. But you should be doing this anyway for clarity, even if you face no performance constraints.