+ let foo x =
+ try
+ (if x = 1 then 10
+ else abort 20) + 1
+ end
+ in (foo 2) + 1;;
+
+we can imagine a box:
+
+ let foo x =
+ +---------------------------+
+ | try |
+ | (if x = 1 then 10 |
+ | else abort 20) + 1 |
+ | end |
+ +---------------------------+
+ in (foo 2) + 1;;
+
+and as we're about to enter the box, we want to take a snapshot of the code *outside* the box. If we decide to abort, we'd be aborting to that snapshotted code.
+
+<!--
+# #require "delimcc";;
+# open Delimcc;;
+# let reset body = let p = new_prompt () in push_prompt p (body p);;
+val reset : ('a Delimcc.prompt -> unit -> 'a) -> 'a = <fun>
+# let foo x = reset(fun p () -> (shift p (fun k -> if x = 1 then k 10 else 20)) + 1) in (foo 1) + 100;;
+- : int = 111
+# let foo x = reset(fun p () -> (shift p (fun k -> if x = 1 then k 10 else 20)) + 1) in (foo 2) + 100;;
+- : int = 120
+-->