| Problem Set 6h | ||||||||||||||||||||||||||
Due date: 10/24 @ 11:59pm
Honors-section homework
HtDP Problems14.2.1-6, 17.2.2, 17.6.1, 21.2.1, 21.2.2, 21.2.3 X-ExpressionsYou may use the Beginning Student Language with List Abbreviations for this problem Here is the data definition for X-expressions:
X-expressions are used to represent XML information within the BSL language
The "teachpack" more-io.ss provides the
function read-xexpr for reading an entire XML files as an
X-expression. To use the teachpack, save it in the same directory as
your code for the problem set. In DrRacket, select the Language >
"Add Teachpack..." menu item, then "Add Teachpack to
List...", then navigate to the location of
Before submitting, any use of Here is a sample XML piece: <week> <assignment> hello <syllabus week="2" src="sample2.xml" /> <syllabus week="1" src="sample1.xml"> world </syllabus> </assignment> done </week> Exercise 1: Represent it as an X-expression to practice your data representation skills. Exercise 2: Your task is to design four functions:
You should notice that two of the functions are one-line definitions, if you use function composition to define them. For your entertainment, this assignment comes with the XML file 6h.xml, which stores information about this assignment. You may use it to run your program (not test). For testing, you must create a simpler file than this.
Exercise 3: The last problem required the design of the
functions: The first step to editing such clusters of functions after they have been properly designed and corrected is to re-organize them into a single function, just like the problem statement (or your boss's request) states for both of the two functions in this problem. Do so.
The reason for organizing code in this manner is to create an
organizational structure for future
readers. If
Exercise 4: XML experts refer to (the interpretation of) an Xexpr as an
element. Design the function
Exercise 5: Abstract
over Hint: Start from the template for all three functions. (Remember that since all three functions process the same kind of input data their templates---i.e., their organizational skeletons---are identical. Then create a function that consumes appropriate "combinators" and "base values" for the various clauses that must be distinct. Knowledge: This abstraction is at the core of many XML processing languages and thus shows up at the heart of many XML libraries. The Snake Game, RevisitedExercise 6: Edit the Snake game we developed in class to use the new ISL abstractions (page 313). | |||||||||||||||||||||||||||
| last updated on Tue Nov 29 19:02:43 EST 2011 | generated with Racket |