On this page:
9.1 Goal
9.2 Language
9.3 Library
9.4 Reading
9.5 Planning
9.6 Programming
9.7 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 Planning

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.

9.6 Programming

You will define the following functions. In doing so, 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).

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.

Note: This assignment has become notorious for plagiarism. Every year we have found a significant number of students have cheated on at least one of the problems. This has gotten tiresome. From this year onward, if you are found to have plagiarised, we will refer you to the Academic Code committee, and you may very well be sanctioned. (You will also not be admitted to 0190.) The argument “I cheated because the problem was hard” does not hold water: the problems are here to set you up for 0190. Do you intend to cheat throughout the semester as well? So please do the work honestly and turn in what you are able to do.

Three of the functions are repeated from Placement 3:
  • external-senders

  • unique

  • fix-shelves

There are four new problem as well:

9.7 Turnin

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

Please name the plan file p4-plan.xml.

Please name the program file p4-code.rkt.

For the test files, please use the following names:

Problem

  

Filename for Tests

external-senders

  

p4-es.rkt

unique

  

p4-unique.rkt

fix-shelves

  

p4-fs.rkt

elim-contains-char

  

p4-ecc.rkt

l33t

  

p4-lt.rkt

is-palindrome

  

p4-ip.rkt

viable-fish

  

p4-vf.rkt

Please remind yourself of the instructions from Placement 3 on the contents of these files.

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