edit
[lambda.git] / assignment9.mdwn
index 36a7015..145904a 100644 (file)
@@ -32,10 +32,10 @@ fringe before starting the comparison, if the fringes differ in an
 early position, we've wasted our time examining the rest of the trees.
 
 The second solution was to use tree zippers and mutable state to
-simulate coroutines (see [[coroutines and aborts]], and [[assignment
-8]]).  In that solution, we pulled the zipper on the first tree until
-we found the next leaf, then stored the zipper structure in the
-mutable variable while we turned our attention to the other tree.
+simulate coroutines (see [[coroutines and aborts]], and
+[[assignment8]]).  In that solution, we pulled the zipper on the first
+tree until we found the next leaf, then stored the zipper structure in
+mutable variable while we turned our attention to the other tree.
 This solution is efficient: the zipper doesn't visit any leaves beyond
 the first mismatch.
 
@@ -57,8 +57,8 @@ Two strategies for solving the problem
     solution.
 
 2.  Review how the continuation-flavored tree\_monadizer managed to
-    map a tree to a list of its leaves, in [[manipulating trees with
-    monads]].  Spend some time trying to understand exactly what it
+    map a tree to a list of its leaves, in [[manipulating trees with monads]].
+    Spend some time trying to understand exactly what it
     does: compute the tree-to-list transformation for a tree with two
     leaves, performing all beta reduction by hand using the
     definitions for bind\_continuation, unit\_continuation and so on.
@@ -104,9 +104,9 @@ class notes for [[week6]] on thunks, as well as [[assignment5]]).
 
 There is a special stream called `End` that represents a stream that
 contains no (more) elements, analogous to the empty list `[]`.
-Streams that are not empty contain a first object paired with a
+Streams that are not empty contain a first object, paired with a
 thunked stream representing the rest of the series.  In order to get
-access to the next element in the stream, we must forced the thunk by
+access to the next element in the stream, we must *force* the thunk by
 applying it to the unit.  Watch the behavior of this stream in detail.
 This stream delivers the natural numbers, in order: 1, 2, 3, ...
 
@@ -118,14 +118,14 @@ val make_int_stream : int -> int stream = [fun]
 val int_stream : int stream = Next (1, [fun])         (* First element: 1 *)
 
 # let tail = match int_stream with Next (i, rest) -> rest;;      
-val tail : unit -> int stream = <fun>                 (* Tail: a thunk *)
+val tail : unit -> int stream = <fun>                      (* Tail: a thunk *)
 
 (* Force the thunk to compute the second element *)
 # tail ();;
-- : int stream = Next (2, [fun])      
+- : int stream = Next (2, [fun])                      (* Second element: 2 *)
 
 # match tail () with Next (_, rest) -> rest ();;
-- : int stream = Next (3, <fun>)
+- : int stream = Next (3, <fun>)                           (* Third element: 3 *)
 </pre>
 
 You can think of `int_stream` as a functional object that provides