From: Jim Pryor Date: Wed, 1 Dec 2010 05:34:22 +0000 (-0500) Subject: lists-to-contin tweaks X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=commitdiff_plain;h=56ec8c944aeb4611b83fceecfe91cfb1dbf54840 lists-to-contin tweaks Signed-off-by: Jim Pryor --- 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)