edits
authorChris Barker <barker@kappa.linguistics.fas.nyu.edu>
Tue, 30 Nov 2010 20:37:50 +0000 (15:37 -0500)
committerChris Barker <barker@kappa.linguistics.fas.nyu.edu>
Tue, 30 Nov 2010 20:37:50 +0000 (15:37 -0500)
week11.mdwn

index 8eae2cc..d1bceb0 100644 (file)
@@ -799,13 +799,15 @@ Aparently, this task, as simple as it is, is a form of computation,
 and the order in which the `'S'`s get evaluated can lead to divergent
 behavior.
 
 and the order in which the `'S'`s get evaluated can lead to divergent
 behavior.
 
-For now, we'll agree to always evaluate the leftmost `'S'`.
+For now, we'll agree to always evaluate the leftmost `'S'`, which
+guarantees termination, and a final string without any `'S'` in it.
 
 This is a task well-suited to using a zipper.  We'll define a function
 
 This is a task well-suited to using a zipper.  We'll define a function
-`tz`, which accomplished the task by mapping a char list zipper to a
-char list.  We'll call the two parts of the zipper `unzipped` and
-`zipped`; we start with a fully zipped list, and move elements to the
-zipped part by pulling the zipped down until the zipped part is empty.
+`tz` (for task with zippers), which accomplishes the task by mapping a
+char list zipper to a char list.  We'll call the two parts of the
+zipper `unzipped` and `zipped`; we start with a fully zipped list, and
+move elements to the zipped part by pulling the zipped down until the
+entire list has been unzipped (and so the zipped half of the zipper is empty).
 
 <pre>
 type 'a list_zipper = ('a list) * ('a list);;
 
 <pre>
 type 'a list_zipper = ('a list) * ('a list);;
@@ -826,13 +828,13 @@ Note that this implementation enforces the evaluate-leftmost rule.
 Task completed.
 
 One way to see exactly what is going on is to watch the zipper in
 Task completed.
 
 One way to see exactly what is going on is to watch the zipper in
-action by tracing the execution of `t1`.  By using the `#trace`
+action by tracing the execution of `tz`.  By using the `#trace`
 directive in the Ocaml interpreter, the system will print out the
 directive in the Ocaml interpreter, the system will print out the
-arguments to `t1` each time it is (recurcively) called.  Note that the
+arguments to `tz` each time it is (recurcively) called.  Note that the
 lines with left-facing arrows (`<--`) show (recursive) calls to `tz`,
 giving the value of its argument (a zipper), and the lines with
 right-facing arrows (`-->`) show the output of each recursive call, a
 lines with left-facing arrows (`<--`) show (recursive) calls to `tz`,
 giving the value of its argument (a zipper), and the lines with
 right-facing arrows (`-->`) show the output of each recursive call, a
-list.  
+simple list.  
 
 <pre>
 # #trace tz;;
 
 <pre>
 # #trace tz;;
@@ -869,7 +871,7 @@ The recipe for constructing the list goes like this:
 -----------------------------------------
 (3)  make a new list whose first element is 'b' and whose tail is the list constructed in step (2)
 (4)  make a new list whose first element is 'a' and whose tail is the list constructed in step (3)
 -----------------------------------------
 (3)  make a new list whose first element is 'b' and whose tail is the list constructed in step (2)
 (4)  make a new list whose first element is 'a' and whose tail is the list constructed in step (3)
-<pre>
+</pre>
 
 What is the type of each of these steps?  Well, it will be a function
 from the result of the previous step (a list) to a new list: it will
 
 What is the type of each of these steps?  Well, it will be a function
 from the result of the previous step (a list) to a new list: it will