Lab 14
Here’s a tiny expression language of numbers and addition:
(define-type AE [num (n number?)] [add (lhs AE?) (rhs AE?)])
Develop interp, that maps an AE to a number by evaluating it in the expected way.
CPS-transform this to produce interp/k.
Add an abort variant to the AE. The abort form should have a single subexpression, and should halt the computation, returning the result of evaluating its subexpression. Update interp so that it uses call/cc to abort the computation on a use of abort
Update interp/k so that when it encounters an abort, it halts without doing further computation. Note that since interp/k is written in CPS, no call/cc is required here!
Additional practice on CPSing, if desired: develop my-foldl, that produces the same result and has the same contract as foldl, then CPS-transform it to obtain my-foldl/k.