CS301 Problem Set 2

This assignment is worth 20 points


For this assignment you'll work a little with the operational semantics of Impcore, and do some elementary list processing in uScheme.

Your assignment is to do Exercises 8 in Ramsey & Kamin Chapter 2, and Exercise 1, 3, and 4(a) in Ramsey and Kamin, Chapter 3.

Requirements

Each programming exercise answer should be in a separate file named exn.scm where n is the exercise number. Where the exercise has several parts, separate them with comments. The uScheme interpreter is located at ~gexia/public/CS301/software/bin/uscheme.

Each of the procedures you define should be followed by test cases that are automatically executed when you enter, for example

(use ex1.scm)

Each test case, if successful, should print #t; if unsuccessful, it should print #f.

Each set of test cases must be preceded by a line of the form 'test-cases-for-count so that I can visually separate the tests.

You must supply a full set of test cases, even (especially!) if you weren't able to get the definition working to your satisfaction. "Full set" means test the "corner cases" (extremes of possible input values) as well as normal cases. For "possible" input values, carefully note the restrictions given in the textbook, as well as my comments below on the individual exercises.

Exercises 8 from Chapter 2 is a "paper exercise". You may hand it in on paper, or electronically, but in any case your solution must follow the notation used in the book for operational semantics - probably difficult to do if you don't use LaTeX.

Comments on the exercises

Note that the transcripts from the textbook (including definitions of the basic set operations) are all available in ~gexia/public/CS301/301-code/transcripts. This public directory also contains other helpful resources supplied by Norman Ramsey.

Now that you've seen let and lambda, for the best answer, see if you can make all your helper functions local.

 


Adapted from Penny Anderson.