CS 2420-20 Homework 15

Due: Tuesday, March 15th, 2011 9:10am

Start with miniracket4.zip.

Part 1 – The Empty List

Add support for empty as a value and a literal expression, and also an empty? predicate expression form. The empty? unary operator takes any value and produces #t if the value is empty, #f otherwise.

Part 2 – Cons Cells

Add cons cells as a new kind of value, along with cons, first, and rest operators. The cons binary operator takes two values and puts them together into a cons-cell value, and the second argument must be either empty or a cons cell (otherwise cons should fail). The first unary operator takes a cons cell and extracts and returns its first value (or fails if the argument value is not a cons cells). The rest unary operator takes a cons cell and extracts and returns its second value (or fails if the argument value is not a cons cells).

Part 3 – Feed Fish

Write the feed-fish function (which takes a list of numbers and returns a list of numbers each incremented by one) and call it as a test case for your MiniRacket interpreter.


Last update: Thursday, April 7th, 2011
mflatt@cs.utah.edu