X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=week11.mdwn;h=c20bc1f9130bc35a0c8cd1d9e18741a96de191bd;hp=14d5eed2745a5ab8cb140fc76c09f477d93d47c6;hb=1c203e3ca6a3b29830af36ea6f6b3a86be93675f;hpb=8fbf14566363197bb08307a6bf4daece2f27602e diff --git a/week11.mdwn b/week11.mdwn index 14d5eed2..c20bc1f9 100644 --- a/week11.mdwn +++ b/week11.mdwn @@ -327,18 +327,18 @@ Anyway, using record types, we might define the tree zipper interface like so: type 'a starred_level = Root | Starring_Left of 'a starred_nonroot | Starring_Right of 'a starred_nonroot and 'a starred_nonroot = { parent : 'a starred_level; sibling: 'a tree };; - type 'a zipper = { tree : 'a starred_level; filler: 'a tree };; + type 'a zipper = { level : 'a starred_level; filler: 'a tree };; let rec move_botleft (z : 'a zipper) : 'a zipper = (* returns z if the targetted node in z has no children *) (* else returns move_botleft (zipper which results from moving down and left in z) *) @@ -349,12 +349,12 @@ Anyway, using record types, we might define the tree zipper interface like so: (* else returns move_right_or_up (result of moving up in z) *) @@ -362,7 +362,7 @@ Anyway, using record types, we might define the tree zipper interface like so: The following function takes an 'a tree and returns an 'a zipper focused on its root: let new_zipper (t : 'a tree) : 'a zipper = - {tree = Root; filler = t} + {level = Root; filler = t} ;; Finally, we can use a mutable reference cell to define a function that enumerates a tree's fringe until it's exhausted: