Sixth Homework

This assignment is due in lab on Monday, November 2. If you haven't already, change your language level to Intermediate Student with Lambda before you begin.

(1) Chapter 19 starts the book's discussion of higher-order functions (functions as arguments). Look at exercises 19.1.1 and 19.1.2; they should be easy for you now, so you don't have to write down the answers.

(2) Chapter 20 continues with higher-order functions. Do exercises 20.1.3, 20.2.1, 20.2.2, 20.2.3, and 20.2.4.

(3) Chapter 21 of the HtDP text starts with an unusually clear design recipe for abstracting, or refactoring, functions. It continues by introducing the predefined functions map, filter, and foldr (also known as reduce or accumulate); we'll talk about these in class on Tuesday. Do exercises 21.1.1., 21.1.2, 21.2.2 (pick just one of the three parts), 21.2.3.

(4) Chapter 22 of HtDP has a section that introduces graphical user interfaces (GUIs). We won't be doing GUIs explicitly this quarter, but if you're intrigued with the GUI-building tools in DrScheme, note that the gui.ss teachpack works differently from the description in section 22.3 of the printed text. You can look up the current gui.ss teachpack documentation in the Help Desk. (DrScheme also has a full-blown set of GUI operations, but they're not in the student languages.)

(5) We're not doing Chapter 23. It's interesting, and functional programming is beautifully suited to mathematical problems, but there are only so many hours in the quarter. If you're interested, come back to this chapter over the winter break.

(6) Intermezzo 4 (Chapter 24) talks about lambda, which you know already. Do exercises 24.0.8 and 24.0.9.

(7) All the programs we've written so far have done their work, displayed their results, and quit without leaving a trace. Now it's time to learn how to read data from a file and write results back to a file so we can maintain information more permanently, even when our program isn't running. For a programming language to enable file input and output, it must work with the operating system (or multiple operating systems) to handle a variety of issues involving different user interfaces, different ways of storing data in files, different naming conventions for files, and different hardware devices. Because there are many options, there are details to consider when we work with files that we haven't had to worry about so far.

There are three main approaches to reading from and writing to files of text. (Reading and writing data directly in the internal form the computer uses to store it in memory is yet another approach, one we'll skip over for now.)

Based in part on ICS H21assignments and exams by David G. Kay from Fall 2001; modified by David G. Kay with material from Informatics 41, Fall 2004-Fall 2009.

David G. Kay, kay@uci.edu
Friday, October 31, 2008 1:08 PM