Skip to content

Latest commit

 

History

History

alg-adts

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Algebra of Algebraic Data Types

Resource 1

Exercise 1

Exercise: Code up the zipper for binary trees, remembering that a zipper is a one-hole context paired with data. You’ll need to write functions left and right to take the left or right path at a particular node, and up to go back up the tree.

Solution: treezipper.hs See Also: listzipper.hs

Exercise 2

Exercise: Rose trees are trees with arbitrarily many branches from each node. In Haskell you would define them by

data Rose a = Rose a [Rose a]

What does a rose tree zipper look like?

Solution: rosezipper.hs