CS536-S06: Assignments

Homework

The following table is the list of homework assignments. Each assignment has a date due. Homework is due before class on the day it is due. Late assignments will not be accepted unless you get approval. I am inclined not to allow late assignments.  Source code should be submitted as a single file, or if there are multiple files, put them into a zipped archive. Other assignments should either be submitted as PDF, Word, or OpenOffice documents, or plain text files. Homework is to be mailed to me.

Assignment # Date Due Description
1 24-Jan Write a short (1-2 page) reflection on your favorite programming language. Consider the following aspects of a programming language in your essay:
  • Expressiveness. What does the language allow and what does it make difficult.
  • Motivation. What is the motivation for the language? Why was it invented / designed? Does it achieve the purpose?
  • Use. What type of problems is the language good for? What type of problems isn't it good for? Why?
Write an ML function that, given a list of integers [x1, x2, x3, x4, ...] computes x1+x2-x3+x4-x5 ...

Write an ML function that, given a list of elements and a second argument that is a single element, returns true if the list contains the element and false otherwise. Can you provide an example of seemingly valid inputs where an error is produced when you try the function? If so, what do you think the problem is?
2 31-Jan Assume that you are going to represent sets as lists. Sets have no duplicate elements and are unordered. In the following problems, we're going to use just lists of integers.
  1. Write functions in LISP that let you add and remove elements from a set.
  2. Write a function in LISP that takes two sets and returns the difference between the first and second set. That is, all elements that are in the first set and not the second.
  3. Write the above functions in ML.
Be prepared to discuss the differences between the LISP and ML interpretations.

Extra credit: Implement in Common LISP, the compose function shown at the bottom of p. 34 in CPL, and use it to compose the two lambda functions at the very bottom of that page.
3 14-Feb Here are two functions to determine if an element is in a list. Research the type of each and describe what the differences are, and whether there is a real difference in these two functions.

fun inList(nil, e) = false
| inList(h::t, e) = (h = e) orelse  inList(t, e);

fun inList nil e = false
| inList (h::t) e = (h = e) orelse inList t e;
MP1 28-Feb Mini-Project 1. Write a test framework that has the same functionality as the one described in chapter 9 of Practical Common Lisp, in ML. Show that it works by providing test cases for your test framework. Document your work well with a description of your design and implementation. You want to convey to the reader the technical structure of your solution as well as directions for how to use it. We may expand upon this for future assignments.
4 3-Mar Do the following problems in Concepts in Programming Languages. 4.3, 4.8, 5.4.
5 21-Mar Problem 6.11 in CPL, page 160.
6 28-Mar Problem 7.5 in CPL, p. 195, 7.10 on p. 197
MP2 18-Apr This mini-project is described here.
7 11-Apr This problem comes from Kevin Menard. If you have two program slices on program P, S1(<i, V1>) and S2(<j, V2>), is the following true: S1 union S2 = S3(<max(i, j)>, V1 union V2)? You can assume that P is a well-structured program (that is, only Bohm-Jacoppini structures are used), and no external functions or procedures that have side-effects are used. Try to formally prove or disprove the conjecture. If you are unable to do so, then provide an informal discussion of the problem and a solution.


Last modified: 4-Aprr-2006
Gary Pollice