mp3 - MP 3 Patterns of Recursion, Higher-order Functions,...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: MP 3 Patterns of Recursion, Higher-order Functions, and Continuation Passing Style CS 421 Fall 2007 Revision 1.2 Assigned September 11, 2007 Due September 18, 2007 23:59 Extension 48 hours (20% penalty) 1 Change Log 1.0 Initial Release. 1.1 Put the appropriate sample output for Problem 14. 1.2 Added a clarification that @ is not to be used. Fixed minor errors, the main ones being: mismatch between types in sample output and the main text in problems 3 and 9. 1.3 Correted the over specific type in problem 16. 2 Objectives and Background The purpose of this MP is to help the student master: 1. forward recursion and tail recursion 2. higher-order functions 3. continuation passing style 3 Instructions The problems below have sample executions that suggest how to write answers. Students have to use the same function name, but the name of the parameters that follow the function name need not be duplicated. That is, the students are free to choose different names for the arguments to the functions from the ones given in the example execution. We also will use let rec to begin the definition of a function that is allowed to use rec . You are not required to start your code with let rec . For all these problems, you are allowed to write your own auxiliary functions, either internally to the function being defined or externally as separate functions. In fact, you will find it helpful to do so on several problems. All helper functions must satisfy any coding restrictions (such as being in tail recursive form, or not using explicit recursion) as the main function being defined for the problem must satisfy. Here is a list of the strict requirements for the assignment. The function name must be the same as the one provided. The type of parameters must be the same as the parameters shown in sample execution. 1 Students must comply with any special restrictions for each problem. Some of the problems require that the solution should be in tail-recursive form or continuation passing style, while others ask students to use higher- order functions in place of recursion. 4 Problems For problems 1 through 9 and 12 through 16, you may not use library functions on @ . In problems 10 and 11, you may not use recursion, and instead must use the library functions specified. In problems 1 through 3 you must use forward recursion. In problems 4 through 6 you must use tail recursion. Problems 12 through 16 must be in continuation passing style. Note: All library functions are off limits for all problems on this assignment, except those that are specifically required (in problems 10 and 11.) For purposes of this assignment @ is treated as a library function and is not to be used.....
View Full Document

Page1 / 8

mp3 - MP 3 Patterns of Recursion, Higher-order Functions,...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online