Abstract
The Zipper pattern is oriented around the traversal and possible mutation of immutable data structures such as trees. Within the Zipper patter the focus is on a particular node in a structure. The Zipper therefore acts like an index or pointer into the structure. It is then possible to move around the structure with respect to the focus point. For example to move forward to backward, or up and down depending upon the semantics of the structure. In general it is also possible to insert before or after (or the left or right) of the current focus point as well as delete the element at the focus. Assuming the structure is immutable; the result of these operations will be the generation of a copy of the original structure but with the modification applied to the copy.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2013 Springer International Publishing Switzerland
About this chapter
Cite this chapter
Hunt, J. (2013). Zipper. In: Scala Design Patterns. Springer, Cham. https://doi.org/10.1007/978-3-319-02192-8_41
Download citation
DOI: https://doi.org/10.1007/978-3-319-02192-8_41
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-02191-1
Online ISBN: 978-3-319-02192-8
eBook Packages: Computer ScienceComputer Science (R0)