a06 - CS 135 Fall 2011 Becker, Goldberg, Kaplan, Tompkins,...

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

View Full Document Right Arrow Icon
CS 135 Fall 2011 Becker, Goldberg, Kaplan, Tompkins, Vasiga Assignment: 6 Due: Tuesday, October 25, 2011 9:00 pm Language level: Beginning Student with List Abbreviations Allowed recursion: Structural and accumulative recursion Files to submit: book.rkt , listmath.rkt Warmup exercises: HtDP 12.2.1, 13.0.3, 13.0.4, 13.0.7, 13.0.8 Practice exercises: HtDP 12.4.1, 12.4.2, 13.0.5, 13.0.6 Updates: 2011.10.19 16:00 In this assignment, if you create an auxiliary function for the sole purpose of adding parameters for accumulative recursion, you must still provide a contract and purpose, but you are not required to provide examples and tests for your auxiliary function. The main (wrapper) function requires a complete design recipe. 2011.10.19 16:00 Note that for this assignment, you will not be penalized for having an ineffi- cient implementation (e.g.: using append ). Your Code Complexity/Quality grade will be determined by how clear your approach to solving the problem is. CS 135 — Fall 2011 Assignment 6 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
You can re-use the provided examples, but you should ensure you have an appropriate number of examples and a sufficient number of tests. All sorted lists are to be sorted in non-decreasing (ascending) order. Functions that produce ordered output should do so intrinsically, and must not sort or reverse an intermediate result. You may use the scheme functions append and member? , but not reverse or any functions not discussed in class. When in doubt, ask a question in Piazza. 1. For this question, place your solution in the file book.rkt . We will represent a Book as a list of pages, where each page is a list of words, and each word is simply a String . In other words, a Book is a ( listof ( listof String )), where each String corresponds to a word in the book, and each ( listof String ) corresponds to a page in the Book . Books and pages can be empty, but ”” is not a valid word. We will ignore any punctuation and capitalization issues, and two words are distinct if they are not string = ? . Because a page is simply a ( listof String ) and a word is a String , we will not explicitly define a Page or Word type. Furthermore, from now on we will use page to refer to the page number and note that page numbering starts at one (not zero). An Occ is a structure that keeps track of a single occurrence of a word in a Book . ( define-struct occ ( word page )) ;; An Occ = (make-occ String Nat) For example, in the provided alice.rkt , the Book constant alice has 6 pages, with page 1 having 7 words. One of those words is ”wonderland” , and the corresponding Occ would be ( make-occ ”wonderland” 1 ).
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/27/2011 for the course CS 135 taught by Professor Vasiga during the Fall '07 term at Waterloo.

Page1 / 5

a06 - CS 135 Fall 2011 Becker, Goldberg, Kaplan, Tompkins,...

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