On this page:
9.1 Goal
9.2 Plagiarism
9.3 Language
9.4 Library
9.5 Reading
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 Plagiarism🔗

This assignment has become notorious for plagiarism. Every year we have found a significant number of students (up to 20%) have cheated on at least one of the problems. In the past we gave students another chance, but this has gotten tiresome, especially given the reason provided.

The standard argument we have heard is, “I cheated because the problem was hard”. This is a terrible argument. The problems are here to both prepare you for 0190 and make sure that it’s the right course for you. If you struggle here, you will struggle there also (perhaps much more!). How do you plan to handle that? Do you intend to cheat throughout the semester as well?

If we have good reason to believe you have plagiarized (which includes the use of ChatGPT-like toolsYou should anyway be careful about using ChatGPT-like tools: recent research shows that it both hurts learning and gives you an inflated sense of confidence.), we will refer you to the Academic Code committee, which will very likely sanction you. You will also not be admitted to 0190. So you will end up with a sanction on a course you didn’t take, couldn’t take, and that you didn’t need to take. What a way, especially for those of you starting college, to begin your academic career!

So please do the work honestly and turn in what you are able to do.

9.3 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.4 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.5 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.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. That’s still recursion; it’s called mutual recursion. 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.

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 two submission drops on Gradescope: one each for programs and tests.

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.