X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=from_lists_to_continuations.mdwn;h=170ae5d4e858b5de4eefaec8a8e104f5580e9a42;hp=8c84dfbd367e78bed1586d002b2fd2bd897031de;hb=56ec8c944aeb4611b83fceecfe91cfb1dbf54840;hpb=4d995119271f7c35e21a6775ee2454b4774b13a6;ds=sidebyside diff --git a/from_lists_to_continuations.mdwn b/from_lists_to_continuations.mdwn index 8c84dfbd..170ae5d4 100644 --- a/from_lists_to_continuations.mdwn +++ b/from_lists_to_continuations.mdwn @@ -74,7 +74,7 @@ entire list has been unzipped (and so the zipped half of the zipper is empty). type 'a list_zipper = ('a list) * ('a list);; - let rec tz (z:char list_zipper) = + let rec tz (z : char list_zipper) = match z with | (unzipped, []) -> List.rev(unzipped) (* Done! *) | (unzipped, 'S'::zipped) -> tz ((List.append unzipped unzipped), zipped) @@ -141,7 +141,7 @@ be a function of type `char list -> char list`. We'll call each step (or group of steps) a **continuation** of the recipe. So in this context, a continuation is a function of type `char list -> char list`. For instance, the continuation corresponding to the portion of -the recipe below the horizontal line is the function `fun (tail:char +the recipe below the horizontal line is the function `fun (tail : char list) -> 'a'::('b'::tail)`. This means that we can now represent the unzipped part of our @@ -153,7 +153,7 @@ The structure and the behavior will follow that of `tz` above, with some small but interesting differences. We've included the orginal `tz` to facilitate detailed comparison: - let rec tz (z:char list_zipper) = + let rec tz (z : char list_zipper) = match z with | (unzipped, []) -> List.rev(unzipped) (* Done! *) | (unzipped, 'S'::zipped) -> tz ((List.append unzipped unzipped), zipped)