X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=zipper-lists-continuations.mdwn;h=0ef943648f2d978ea838dfc81ed736c62db9ded2;hp=a2603dbad674c97dfae216d022e1cc0f58ce559f;hb=b9ab5e640cf6ead61cd72c4a484dd55d239a2bb5;hpb=89f14f08b65f2eb905065135670fbb1712cb9b16 diff --git a/zipper-lists-continuations.mdwn b/zipper-lists-continuations.mdwn index a2603dba..0ef94364 100644 --- a/zipper-lists-continuations.mdwn +++ b/zipper-lists-continuations.mdwn @@ -275,7 +275,7 @@ similar to the List monad just given: type 'a continuation = ('a -> 'b) -> 'b c_unit (x:'a) = fun (p:'a -> 'b) -> p x c_bind (u:('a -> 'b) -> 'b) (f: 'a -> ('c -> 'd) -> 'd): ('c -> 'd) -> 'd = -fun (k:'a -> 'b) -> u (fun (x:'a) -> f x k) + fun (k:'a -> 'b) -> u (fun (x:'a) -> f x k) How similar is it to the List monad? Let's examine the type @@ -294,16 +294,15 @@ parallel in a deep sense. To emphasize the parallel, we can instantiate the type of the list' monad using the Ocaml list type: type 'a c_list = ('a -> 'a list) -> 'a list - let c_list_unit x = fun f -> f x;; - let c_list_bind u f = fun k -> u (fun x -> f x k);; -Have we really discovered that lists are secretly continuations? -Or have we merely found a way of simulating lists using list +Have we really discovered that lists are secretly continuations? Or +have we merely found a way of simulating lists using list continuations? Both perspectives are valid, and we can use our intuitions about the list monad to understand continuations, and vice -versa. The connections will be expecially relevant when we consider -indefinites and Hamblin semantics on the linguistic side, and -non-determinism on the list monad side. +versa (not to mention our intuitions about primitive recursion in +Church numerals too). The connections will be expecially relevant +when we consider indefinites and Hamblin semantics on the linguistic +side, and non-determinism on the list monad side. Refunctionalizing zippers -------------------------