- in let continue_foo_normally = fun from_value ->
+ in let continue_foo_snapshot = fun from_value ->
let value = from_value + 100
in outer_snapshot value
in (* start of foo_applied_to_x *)
let value = from_value + 100
in outer_snapshot value
in (* start of foo_applied_to_x *)
- if x = 1 then continue_foo_normally 10
+ if x = 1 then continue_foo_snapshot 10
else outer_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.
else outer_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.
@@ -442,10+442,10 @@ There are also different kinds of "syntactic sugar" we can use to hide the conti
let outer_snapshot = fun box ->
let foo_result = box
in (foo_result) + 1000
let outer_snapshot = fun box ->
let foo_result = box
in (foo_result) + 1000
- in let continue_foo_normally = fun from_value ->
+ in let continue_foo_snapshot = fun from_value ->