Advanced Compilers & Programming Language Theory
Q98 / 100

What is the relationship between CPS transformation and continuation monad?

Correct! Well done.

Incorrect.

The correct answer is B) The continuation monad (Cont r a = (a → r) → r) captures CPS computationally: flatMap composes continuations exactly as CPS transformation chains function calls

B

Correct Answer

The continuation monad (Cont r a = (a → r) → r) captures CPS computationally: flatMap composes continuations exactly as CPS transformation chains function calls

Explanation

CPS transform: f(x) becomes λk.k(f_cps(x)). The continuation monad Cont r a = (a→r)→r has bind that composes these exactly. callCC in the monad corresponds to grabbing the current continuation. Equational connection between operational and denotational semantics.

Progress
98/100