# CSC 160 Homework 8

## Assigned Dec. 3, due Dec. 10

Write a well-structured paragraph (or more, if you think you have more to say) about one of the following topics:

• List some of the most common mistakes you've made in programming this semester. Discuss at least one "interesting" mistake you've made (i.e. not a misspelling, a misplaced parenthesis, or anything purely syntactic like that). How did you discover it, what had you done to cause it, and how did you fix it?
• Re-read the adages page, and choose one (or several closely-related) adages that mean more to you than they did in September. Do you agree or disagree? Support your claims with specific examples from your own programming experience.
Note: this writing assignment is to be done individually.

## Assigned Dec. 3, not to be turned in

Do but don't turn in the following exercises. Some of these will be on the final exam, so you can count this as studying for the final.

• Define a struct to represent a person, with a name and an age. Then develop a function `youngest`, which takes a non-empty list of persons and returns the youngest one.
• Problems 11.2.1, 11.2.2, 11.4.2, 11.4.7 and 11.5.1 from the textbook.
(Note on 11.5.1: The assignment is to write an `add` function without using the built-in + operator. You may, however, use the built-in `add1` function, which adds 1. Hint: Treat one of the parameters, `n`, as a natural number; the other, `x`, should be considered as just a number.)
• Read sections 12.1 and 12.2 and understand the `sort` function. To test your understanding, try problem 12.2.1.
• Problem 18.1.15 (Note: we've already done the similar problem 18.1.12 in class. These problems are numbered 18.1.whatever in the printed text, and 18.2.whatever in the on-line text.)
• Develop a function `print-stars` that takes in a natural number and displays that many asterisks, one after another on the same line. (This will use the built-in `display` function and the `begin` form.)
• Develop a cooperating pair of functions named `count-calls` and `reset`. Each function takes no arguments (which means you need to be in Advanced Student mode to write them). `reset` returns nothing at all, while `count-calls` returns how many times it has been called since the last time `reset` was called. (Such a pair of functions might be used, for example, in a hit counter for a Web page.) Hint: Use a global variable, which both functions can modify (using `set!`), to keep track of the count. You may also need `begin`.