Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Zippers presentation

Short presentation related to the zipper data structure

  • Login to see the comments

  • Be the first to like this

Zippers presentation

  1. 1. Zippers! Functional programming !
  2. 2. –Gérard Huet!
  3. 3. “Zipper is a functional cursor into a data structure”
  4. 4. Often used where there is some concept of 'focus' or of moving around in some set of data.!
  5. 5. Includes and generalizes the gap buffer technique
  6. 6. Data structure? Can be adapted to Lists, trees, and other recursively defined data structures!
  7. 7. Data structure! The current subtree / subset! Trees, Paths and Locations The current element / Zipper cursor!
  8. 8. Scalaz
  9. 9. NonEmptyList!
  10. 10. Sample list… (2 3 5 7 11)
  11. 11. Traversing… 2 (3 5 7 11) Zipper!
  12. 12. Traversing… (2) 3 (5 7 11) Zipper!
  13. 13. Traversing.… Reverse???! (3 2) 5 (7 11) Zipper!
  14. 14. Traversing.… Reverse???! Parent retrieve = 0(1)! (3 2) 5 (7 11) Zipper!
  15. 15. Traversing..… (5 3 2) 7 (11) Zipper!
  16. 16. Traversing…… (7 5 3 2) 11 Zipper!
  17. 17. Traversed. (11 7 5 3 2)
  18. 18. “Imm utab How to add an item?! How to delete an item?! Changes, Insertions and Deletions? “Laziness”?! ility” ? !
  19. 19. Depends on the data structure, but prefer lazy evaluations
  20. 20. Implementation http://scalaz.googlecode.com/svn/continuous/latest/browse.sxr/scalaz/TreeLoc.scala.html http://scalaz.googlecode.com/svn/continuous/latest/browse.sxr/scalaz/Zipper.scala.html !

×