Lab 11

Here’s a tiny expression language of numbers and addition:

  (define-type AE
    [num (n number?)]
    [add (lhs AE?) (rhs AE?)])

  1. develop interp : AE? -> number

  2. CPS-transform this to produce interp/k.

  3. Add an ’abort’ variant to the AE.

  4. update interp/k so that when it encounters an ’abort’, it halts without doing further computation.

  5. develop my-foldl, that produces the same result and has the same contract as foldl

  6. CPS-transform this to produce foldl/k.