Problem Set 5

home work!

Programming Language ISL

Purpose This problem set concerns the design of abstractions.

Finger Exercises HtDP/2e: 205, 206, 209, 210

image

Problem 1 Exercise 210 from HtDP/2e

Problem 2 Exercise 212 from HtDP/2e

Problem 3 Exercise 213 from HtDP/2e

Problem 4 Exercise 214 and 215 from HtDP/2e

Problem 5 Interpret the following data definition:

; [List-of [Number -> Number]]

Design 0 at-0. The function consumes a list of functions from numbers to numbers and produces the list of results of applying these functions to 0.

Problem 6 Design find-string. The function consumes a [List-of String] and a String; it returns a true if and only if the given string is a member of the list.

Abstract find-string to generic-find-string so that the string comparison operation it uses is a parameter. Then use this abstraction to define find-string-case-sensitive, which should operate the same way as the original find-string, and find-string-case-insensitive, which has the same contract as find-string but ignores the case of alphabetic characters when comparing strings. That is, "a" is considered the same as "A" and so on; non-alphabetic characters must still match exactly. Look in the documentation for ISL to find appropriate primitive functions.