Lecture 17: Built-in abstractions
This assignment is due on Sunday, October 20 at 11:59pm. Submit it using Handin as assignment lecture17.
1 Built-in abstractions
What is the name of the function?
How many inputs does the function take? What are their names?
How many inputs does the signature take? What are their names?
; Exercise 1 ; The function ??? has ??? inputs, called ??? and ???. ; Its signature has ??? inputs, called ??? and ???.
Design a function filter-without-a that takes a list of strings as input and returns the list of all the given strings that do not contain the letter "a". Hint: What is X? The built-in functions not and string-contains? will help.
Design a function filter-x<y that takes a list of Posns as input and returns the list of all the given Posns whose X coordinate is less than their Y coordinate. Hint: What is X? Design a helper function that follows the template for processing a Posn.
Design a function add-to-all that adds a given number to every number in a given list. Hint: What is X and what is Y? Use either local or lambda.
Remember the function move-invaders from Lecture 14: Built-in structures? It takes and returns a [ListOf Posn]. It increases each Y coordinate by 1. Design it again, still named move-invaders. Hint: What is X and what is Y? Design a helper function that follows the template for processing a Posn.
The code written in the videos above is available for your reference. To download it, don’t use “Save Page As” or “Save As”; use “Save Link As” or “Download Linked File” in your Web browser. If you can’t find the command, try right-clicking or two-finger-tapping or long-pressing.
Optional: Read Chapters 17–18 of the textbook.