lists-to-contin tweaks
[lambda.git] / coroutines_and_aborts.mdwn
index 31da08f..8cca9e3 100644 (file)
@@ -583,7 +583,8 @@ When working with continuations, it's easiest in the first place to write them o
        let foo x =
            try begin
                (if x = 1 then 10
-               else abort 20) + 100
+               else abort 20
+                       ) + 100
            end
        in (foo 2) + 1;;
 
@@ -593,11 +594,11 @@ into this:
        in let snapshot = fun box ->
                let foo_result = box
                in (foo_result) + 1000
-       in let finish_value = fun start ->
-               let value = start + 100
+       in let continue_normally = fun from_value ->
+               let value = from_value + 100
                in snapshot value
        in 
-               if x = 1 then finish_value 10
+               if x = 1 then continue_normally 10
                else snapshot 20;;
 
 Code written in the latter form is said to be written in **explicit continuation-passing style** or CPS. Later we'll talk about algorithms that mechanically convert an entire program into CPS.