On this page:
9.1 Goal
9.2 Language
9.3 Library
9.4 Reading
9.5 Task
9.6 Turnin

9 Placement 4

9.1 Goal

Functional programmers don’t actually spend all day writing recursive functions over lists. Rather, they use so-called “higher-order” functions, which are functions that consume other functions, to do that kind of work. That is, in functional programming, a loop is just a function, and different kinds of loops correspond to different kinds of higher-order functions. In this assignment you will learn about some of these “looping functions”.

9.2 Language

For the following assignment, you must use Racket’s Intermediate Student with lambda language. Go to the Language menu, select Choose Language, and pick the language from the Teaching Languages section.

9.3 Library

You will not need more than the following higher-order functions:
  • map

  • filter

  • foldl

  • foldr

  • andmap

  • ormap

You may also use any library function you were permitted to use on prior assignments, particularly in Placement 3.

Note that you cannot use reverse unless you implement it yourself (following the rules below).

9.4 Reading

You will read from Part 3 of HtDP 2/e, specifically
  • 14.1

  • 14.2

  • 14.4

  • 15.1

  • 15.4

  • 16.1

  • 16.2

  • 16.5

You can read the rest if you feel the need as you’re doing the assignment.

9.5 Task

Ultimately, you need to define the same functions as in Placement 3. However, you are not allowed to use recursion (where a function calls itself) directly;Don’t try to be clever about this, e.g., having A call B and then B call A. you must use one of the functions listed in Library in its stead. You are of course welcome to write helper functions (that follow the same rule).

Building on recent research in computing education, we are asking you to plan your solutions before you code them. The description of the planning component is given in this document. Please read it carefully and follow the instructions there.

For the programming part, you are welcome to reuse anything appropriate that you wish from your Placement 3 submission, e.g., purpose statements and tests. You do not need to write templates.

We do expect you to do a thorough job on testing, building on the feedback you receive for Placement 3.

Don’t be surprised if you find some of the functions challenging.

9.6 Turnin

You will have three submission drops on Gradescope: one each for your plans, your program, and your tests.

For the plans, please follow the instructions in the planning document. For the other two drops, please follow the same instructions as for Placement 3 except that you use the prefix p4- rather than p3- for all the filenames.

Failure to follow any of these instructions may result in zero credit.