X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=assignment9.mdwn;h=13cf8fd4a89c9165cc201589cfa402312d7f71d7;hp=20a8968dcd807b1d79505b23fbf6b5cc882014e4;hb=d0c1b524d79cd88b2979d7825dc297bbbddc4f22;hpb=f5af9a2dbe19bcd70978009a80771ab0f381c710 diff --git a/assignment9.mdwn b/assignment9.mdwn index 20a8968d..13cf8fd4 100644 --- a/assignment9.mdwn +++ b/assignment9.mdwn @@ -62,7 +62,7 @@ Two strategies for solving the problem 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. - If you take this route, study the description of streams (a + If you take this route, study the description of **streams** (a particular kind of data structure) below. The goal will be to arrange for the continuation-flavored tree_monadizer to transform a tree into a stream instead of into a list. Once you've done @@ -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 = (* 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]) (* Second element: 2 *) +- : int stream = Next (2, [fun]) (* Second element: 2 *) # match tail () with Next (_, rest) -> rest ();; -- : int stream = Next (3, ) (* Third element: 3 *) +- : int stream = Next (3, [fun]) (* Third element: 3 *) You can think of `int_stream` as a functional object that provides