consistently use k for continuations
[lambda.git] / manipulating_trees_with_monads.mdwn
index 379ead5..a05fa25 100644 (file)
@@ -262,25 +262,25 @@ That is, nothing happens.  But we can begin to substitute more
 interesting functions for the first argument of `treemonadizer`:
 
        (* Simulating the tree reader: distributing a operation over the leaves *)
 interesting functions for the first argument of `treemonadizer`:
 
        (* Simulating the tree reader: distributing a operation over the leaves *)
-       # treemonadizer (fun a c -> c (square a)) t1 (fun i -> i);;
+       # treemonadizer (fun a k -> k (square a)) t1 (fun i -> i);;
        - : int tree =
        Node (Node (Leaf 4, Leaf 9), Node (Leaf 25, Node (Leaf 49, Leaf 121)))
 
        (* Simulating the int list tree list *)
        - : int tree =
        Node (Node (Leaf 4, Leaf 9), Node (Leaf 25, Node (Leaf 49, Leaf 121)))
 
        (* Simulating the int list tree list *)
-       # treemonadizer (fun a c -> c [a; square a]) t1 (fun i -> i);;
+       # treemonadizer (fun a k -> k [a; square a]) t1 (fun i -> i);;
        - : int list tree =
        Node
         (Node (Leaf [2; 4], Leaf [3; 9]),
          Node (Leaf [5; 25], Node (Leaf [7; 49], Leaf [11; 121])))
 
        (* Counting leaves *)
        - : int list tree =
        Node
         (Node (Leaf [2; 4], Leaf [3; 9]),
          Node (Leaf [5; 25], Node (Leaf [7; 49], Leaf [11; 121])))
 
        (* Counting leaves *)
-       # treemonadizer (fun a c -> 1 + c a) t1 (fun i -> 0);;
+       # treemonadizer (fun a k -> 1 + k a) t1 (fun i -> 0);;
        - : int = 5
 
 We could simulate the tree state example too, but it would require
 generalizing the type of the continuation monad to
 
        - : int = 5
 
 We could simulate the tree state example too, but it would require
 generalizing the type of the continuation monad to
 
-       type ('a -> 'b -> 'c) continuation = ('a -> 'b) -> 'c;;
+       type ('a -> 'b -> 'k) continuation = ('a -> 'b) -> 'k;;
 
 The binary tree monad
 ---------------------
 
 The binary tree monad
 ---------------------