COSC 8 -- Problem Solving with CS

CS 8, Fall 2009

Short Assignment 5: Currying and Composition

Instructions

You should print out your solutions to this assignment, and either turn them in at lecture, or leave them in the TA's mailbox at Sudikoff by class time on Fri. Oct. 9, 2009.

Please also e-mail an electronic version of your code to cs8hw@cs.dartmouth.edu, with the subject "CS 8 Short Assignment 5". Please attach your code as one or more enclosures to the message, and do not include it directly in the body of the e-mail message.

You must work alone on this short assignment.


  1. Applying functions recursively

    Solve Exercises 9.4 and 9.5 on p. 108 of SOE by writing recursive functions. (Call them applyEachR and applyAllR.) Give the principal types of the functions.

  2. Applying functions using higher-order functions

    Solve Exercise 9.5 on p. 108 of SOE by writing a higher-order function involving the apply operator $.

    Extra Credit - Solve Exercise 9.4 on p. 108 of SOE by writing a higher-order function involving $ and other functions that we have seen.

  3. Combining sections

    Solve 9.10 and 9.11 on p. 113 of SOE.

  4. Written Exercise

    Solve Exercise 9.3. Justify your answer.