CISC-280 Program Development Techniques

Homework 5: Sequences and Symbol Manipulation 

Due: Thursday, October 30th

  1. (10 points) Exercise 2.36, page 120, accumulate-n.
  1. (25 points) Exercise 2.37, page 120-121, Matrix Arithmetic using accumulate and map.
  1. (30 points) Manipulating symbols to generate sentences. In the scheme file found <here> we saw a fairly bad attempt to implement a grammar that generated random sentences. The implementation was limed in several ways (including the rules of the grammar which are restricted to have at most two alternatives).
Your job is to broaden this implementation so that it can handle more sophisticated grammar such as that found in the slides in class found <print-version-of-slides>. Make sure you handle the recursive rules such as NP -> NP PP too.

Give your grammar some words, and generate random sentences with it.
  1. (15 points) Exercise 2.61, page 155, adjoin-set for set represented as ordered lists.