Saturday, June 12, 2010

day 3.

Zipper Data Structure

It is a detail of implementation of aggregate data structures which can be constructed inductively. It is a method of encapsulating both the structure itself as well as an unobtrusive indication of an arbitrary position within the structure. In fact, it is more appropriate to say that it exists to keep track of a location inside the data structure.
An example would be for a list [1,2,3,4] with position 3 to be represented as the tuple: ([2,1],[3,4]) and moving left or right will give us ([1],[2,3,4]) or ([3,2,1],[4]) respectively.