From 1c203e3ca6a3b29830af36ea6f6b3a86be93675f Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Tue, 30 Nov 2010 11:28:33 -0500 Subject: [PATCH 1/1] week11 tweaks Signed-off-by: Jim Pryor --- assignment8.mdwn | 4 ++-- week11.mdwn | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/assignment8.mdwn b/assignment8.mdwn index 59e0090b..5a2780d8 100644 --- a/assignment8.mdwn +++ b/assignment8.mdwn @@ -5,7 +5,7 @@ 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 *) @@ -23,7 +23,7 @@ let new_zipper (t : 'a tree) : 'a zipper = - {tree = Root; filler = t} + {level = Root; filler = t} ;;   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: -- 2.11.0