Homework 3



This homework is due on Thursday 21st November (This deadline is immutable). I encourage you to do questions 2 and 3 before the next learning experience (Thursday 14th November).

This homework deals with Functional programming and JAVA.

This homework is to be done in a group of two students by following the rules of 'Extreme Mathematical Thinking' and 'Pair Programming'. Take advantage of working in group. The groups are assigned. You can find the email of your group member in the Blackboard. If you are alone it means that you asked me to be alone or I do not have enough information (grades) to assign you a group. The groups were provided.

You have to submit a report concerning your group member. These reports can be given apart (but must be given on 11/21/2002). In case of problem with your group member during the time of the homework please contact me (but you cannot change group). Your grade will be based on the reports you will submit. It means that if you are in the same group it does NOT mean you will have the same grade.

Students have to hand-in a hard-copy with their answers and the listing of all their JAVA and SML code. The presentation of your homework will be taken into account and you have to do the questions in order. The JAVA and SML code must be accessible from matrix in the directory called CS361/HW3/. ALL your SML code must be saved in a file called smlcode.txt. Do not put anything except SML code in smlcode.txt. The SML code has to be submitted on-line also. Click here to have information about how to submit your SML code online. The JAVA code you write must be clear and commented. All the explanations to access the code on matrix must be provided in your hard-copy on the cover page. Your JAVA code will not be submitted online but will be only available on matrix.

All the names (names of directories, files, classes, methods, ...) must be respected (exactly) for automated testing.

1. We saw in class that to compute A andalso B (SML syntax for A and B) SML uses a lazy evaluation. When computing A && B, does JAVA use a eager or lazy evaluation? Provide the JAVA code you used to test if A and B is evaluated by eager or lazzy evaluation in JAVA.

2. We decide to represent a set by a list (without duplicates). For example, the set {1,2,4,2,6} will be represented by [1,2,4,6].
We propose to write the following functions on sets. For definitions concerning sets and set operations read these slides.

Write the functions isSet, isEmptySet, isInSet and ONE of the following functions: unionSets, intersectSets and differenceSets.

3. Choose and do ONE of the following exercises: 4. Extra-credit Choose and do ONE of the following exercises: