Homework #18


This problem requires Lecture 15 and book sections 3.1-3.2.

Exercise 3.7, p.79 - (45 minutes)
Add list processing primitives to the language, including cons, car, cdr, list, and a new variable, emptylist, which is bound to the empty list. Since there is no support for symbols, lists can contain only numbers and other lists. How does this change the epressed and denoted values of the language?
--> list(1,2,3)
(1 2 3)
--> car(cons(4,emptylist))
4

In this problem you add lists to the interpreter.

NOTE: In the initial environment, emptylist should be bound to ():

    > (run "emptylist")
    ()

    > (run "cons( 4, cons( 5, emptylist ) )")
    (4 5)

The process for adding the cons, list, car, and cdr primitive functions should be much like what you did in Homework 16.

Here is the code for the Lecture 15 interpreter to start with.


You must log in first before submitting homework assignments.

Instructions on submitting homework is here


Last updated at 2:43 pm on Thursday, March 03, 2005.