How well do zippers perform in practice, and when should they be used?

Posted by Rob on Stack Overflow See other posts from Stack Overflow or by Rob
Published on 2010-03-28T03:05:09Z Indexed on 2010/03/28 3:13 UTC
Read the original article Hit count: 386

I think that the zipper is a beautiful idea; it elegantly provides a way to walk a list or tree and make what appear to be local updates in a functional way.

Asymptotically, the costs appear to be reasonable. But traversing the data structure requires memory allocation at each iteration, where a normal list or tree traversal is just pointer chasing. This seems expensive (please correct me if I am wrong).

Are the costs prohibitive? And what under what circumstances would it be reasonable to use a zipper?

© Stack Overflow or respective owner

Related posts about functional-programming

Related posts about zipper