CS 5010: Problem Set 05

Out: Monday, 13 February 2017
Due: Monday, 20 February 2017 at 6pm

This is an individual assignment. You are not allowed to discuss this problem set with any other person. You are also not allowed to search for or to view any solutions to similar problems that may be available on the World-Wide Web or in other resources that might otherwise have been available to you.

The main purpose of this problem set is to give you practice programming with higher order functions (HOFs).

You must use the HtDP Intermediate Student Language + Lambda for this problem set. You are to use HOFs wherever appropriate. These HOFs will replace most (and possibly all) of your uses of the ListOfX template.

For these problems, download a copy of extras.rkt and put it in the folder with your solutions. Then import this library by including the line

      (require "extras.rkt")
    

at the top of your file with the other require declarations. Then, for each problem, put in lines that say

      (provide function)
    

for each deliverable function, as you have done on previous problem sets. This will allow our testing framework to import your file and do automated testing on it. You can use check-location to double-check that your solutions are in the right place.

Remember that you must follow the design recipe, which is a process, not a list of deliverables. Your deliverables include the artifacts produced by the various steps of the design recipe: data definitions (including interpretation and templates, contracts, purpose statements, definitions, and tests). Be sure to follow our coding conventions. Doing so will make codewalks easier for everyone.

Be sure to fill out a work session report at the end of each work session. Tell git to add it to the files you will commit, and then commit and push (sync) that report in addition to committing and pushing your entire set05 directory. Do this at the end of every work session.

Remember to include a copy of extras.rkt racket in your set05 directory along with your q1.rkt and q2.rkt files.


  1. Rewrite your q1.rkt from Problem Set 04 to use higher-order functions whenever possible instead of using recursions to traverse lists. Provide the same functions as in Problem Set 04. Name your file q1.rkt, as in Problem Set 04.
  2. Rewrite your q2.rkt from Problem Set 04 to use higher-order functions whenever possible instead of using recursions to traverse lists. Provide the same functions as in Problem Set 04. Name your file q2.rkt, as in Problem Set 04.

For debugging: Click here to validate.