CS 5010: Problem Set 06

Out: Monday, 16 October 2017
Due: Monday, 23 October 2017 at 6pm local time

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 Racket's Intermediate Student Language + Lambda for this problem set.

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

      (require rackunit)
      (require "extras.rkt")

at the top of your file. 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. Be sure to report only the hours spent in that work session; do not report the cumulative time. Tell git to add your work session report to the files you will commit, and then commit and push (sync) that report in addition to committing and pushing your entire set06 directory. Do this at the end of every work session.

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

For question 1, you should require rackunit and "extras.rkt" but nothing else.

For question 2, you should require rackunit, 2htdp/image, 2htdp/universe, and "extras.rkt", but nothing else.


  1. (ListPractice2)

    Rewrite your q1.rkt program from Problem Set 04 to use higher-order functions instead of using recursions to traverse lists. Do this for all traversals in your program, not just in the deliverable functions. However, there may be functions in your program for which the use of higher-order functions is not possible or is not appropriate. Be prepared to defend your choices at codewalk.

    Provide the same functions as in Problem Set 04. Name your file q1.rkt, as in Problem Set 04.

  2. (SquashPractice4)

    Rewrite your q2.rkt program from Problem Set 04 to use higher-order functions instead of using recursions to traverse lists. Do this for all traversals in your program, not just in the deliverable functions. However, there may be functions in your program for which the use of higher-order functions is not possible or is not appropriate. Be prepared to defend your choices at codewalk.

    Provide the same functions as in Problem Set 04. Name your file q2.rkt, as in Problem Set 04.