In the following expressions, identify the next expression to be evaluated and its continuation by marking the former with [ · ]. What is the type of the former? Given a value of this type, what is the type of the value returned by the continuation?
-
5 * (2 * 3 + 3 * 4)
next expression:
2 * 3
continuation:
5 * ([.] + 3 * 4)
next expression type: int
continuation type: int -> int_
-
(if 2 = 3 then "hello" else "hi") ^ " world"
next expression:
(2 = 3)
continuation:
(if [.] then "hello" else "hi") ^ " world"
next expression type: boolean
continuation type: boolean -> string
-
fst (let x = 1 + 2 in (x, x))
next expression:
(1 + 2)
continuation:
fst (let x = [.] in (x,x))
next expression type: boolean
continuation type: boolean -> string
-
string_length ("x" ^ string_of_int (3 + 1))
next expression:
(3 + 1)
continuation:
string_length ("X" ^ string_of_int [.])
next expression type: int
continuation type: int -> int