Lecture 15: Abstraction
This assignment is due on Sunday, October 13 at 11:59pm. Submit it using Handin as assignment lecture15. You only need to submit the first 2 exercises.
; A ListOfNumbers is one of: ; - empty ; - (cons Number ListOfNumbers)
Exercise 1. Design a function triple-numbers that takes a ListOfNumbers and triples every number in it to produce a new ListOfNumbers.
Hint: Review the first two videos of Lecture 14: Built-in structures and follow the template process-lon developed there.
Exercise 2. Design a function product that takes a ListOfNumbers and multiplies the numbers together.
Hint: Review the first two videos of Lecture 14: Built-in structures and follow the template process-lon developed there.
For the rest of this page, you don’t need to submit anything. Come to class! It will not be recorded.
Exercise 3. Recall that we designed a function in class that doubles every number in a ListOfNumbers. Compare that function and triple-numbers: How are they similar? How are they different?
Exercise 4. Recall that we designed a function in class that sums up a ListOfNumbers. Compare that function and product: How are they similar? How are they different?
Optional: Read Chapters 14 and 15 of the textbook.