Zippers presentation

1,513 views

Published on

Short presentation related to the zipper data structure

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,513
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

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 !

×