CS 131 Homework 8

Due by the beginning of class Wednesday, April 5
  1. Study this week's class notes on continuation-passing style (CPS).

  2. Convert the following ten programs to CPS. Use the function init-k as your initial continuation when testing your code.

  3. Add an (abort) primitive to the interpreter, using

    as your starting point. When the interpreter evaluates an (abort) expression, it should simply abort the current computation in progress and return the symbol aborted to top level, without exiting from the read-eval-print loop. You may implement abort however you like, either as a primitive function or as a special form. For example:

    > (start)
     
    Welcome to the CS 131 Ploy interpreter
     
    ==> (2 + (100 * (4 + (abort))))
    aborted
    ==> (2 + 3)
    5
    ==>
    

Turning in your homework

Put your ten CPS function definitions into a single Scheme file named cps-functions.ss. Files to submit:

If you have questions about anything, just ask!