Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.
Zippers!

Functional programming !
–Gérard Huet!
“Zipper is a functional cursor
into a data structure”
Often used where there is some concept of
'focus' or of moving around in some set of
data.!
Includes and generalizes
the gap buffer technique
Data structure?

Can be adapted to Lists, trees, and other recursively
defined data structures!
Data structure!
The current subtree / subset!

Trees, Paths and Locations

The current element / Zipper cursor!
Scalaz
NonEmptyList!
Sample list…

(2 3 5 7 11)
Traversing…

2 (3 5 7 11)

Zipper!
Traversing…

(2) 3 (5 7 11)

Zipper!
Traversing.…

Reverse???!

(3 2) 5 (7 11)

Zipper!
Traversing.…

Reverse???!

Parent retrieve = 0(1)!

(3 2) 5 (7 11)

Zipper!
Traversing..…

(5 3 2) 7 (11)

Zipper!
Traversing……

(7 5 3 2) 11

Zipper!
Traversed.

(11 7 5 3 2)
“Imm

utab

How to add an item?!
How to delete an item?!

Changes, Insertions and
Deletions?

“Laziness”?!

ility”
?
!
Depends on the data structure, but prefer lazy
evaluations
Implementation

http://scalaz.googlecode.com/svn/continuous/latest/browse.sxr/scalaz/TreeLoc.scala.html

http://scalaz.goo...
Zippers presentation
Prochain SlideShare
Chargement dans…5
×

Zippers presentation

Short presentation related to the zipper data structure

  • Identifiez-vous pour voir les commentaires

  • Soyez le premier à aimer ceci

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 !

×