

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


COP 4020 — Programming Languages I January 15, 2008
Due: Monday, January 14, 2008. In this homework you will learn some of the basics of Oz and the Mozart system [UseModels], and will get an overview of programming concepts [Concepts]. For all Oz programing exercises, you must run your code using the Mozart/Oz system. See the course’s “Running Oz” page for instructions about installation and troubleshooting of the Mozart/Oz system on your own computer. For programming problems for which we provide tests, you can find them all in a zip file, which you can download from the course resources web page or from WebCT. If the tests don’t pass, please try to say why they don’t pass, as this enhances communication and makes commenting on the code easier and more specific to your problem. Our tests use the functions in the course library’s TestingNoStop.oz. The Test procedure in this file can be passed an actual value, a connective (which is used only in printing), and an expected value, as in the following statement.
{Test {CombA 4 3} ’==’ 24 div (6*1)}
The Assert procedure in this file can be passed a boolean, as in the following statement
{Assert {Comb J I} == {CombB J I}}
Calls to Assert produce no output unless they are passed the argument false. Note that you would not use Browse or Show around a call to Test or Assert. If you’re not sure how to use our testing code, ask us for help. Turn in (on WebCT) your code and output of your testing for all exercises that require code. Please upload code as text files with the name given in the problem or testing file and with the suffix .oz. Please use the name of the main function as the name of the file. Please upload test output and English answers as plain text files with suffix .txt or as PDF files with suffix .pdf. (In any case, don’t put any spaces in your file names!) Your code should compile with Oz, if it doesn’t you probably should keep working on it. If you don’t have time, at least tell us that you didn’t get it to compile. You should use helping functions whenever you find that useful. Unless we specifically say how you are to solve a problem, feel free to use any functions from the Oz library (base environment), especially functions like Map and FoldR. Don’t hesitate to contact the staff if you are stuck at some point. For background, you should have already read Chapter 1 of the textbook [RH04] (except section 1.7). But you may also want to refer to the reference and tutorial material on the Mozart/Oz web site. See also the course resources page.
The following problems are from the textbook [RH04, section 1.18].
References
[RH04] Peter Van Roy and Seif Haridi. Concepts, Techniques, and Models of Computer Programming. The MIT Press, Cambridge, Mass., 2004.