Unformatted text preview: b. For this example, give the function calls to obtain the value “5” from the list representation of the tree (use car and cdr or shorthand combinations thereof if you prefer them). 5. Define a Scheme function “allpos” that takes a list of integers, applies a function that converts an integer to true if the integer is positive and to false otherwise, and reduces the resulting list to a single true/false by conjunction. To keep our code compact, use higher-order Scheme functions whenever possible. See lecture slide 27. The result should be: (allpos ‘(1 2 3)) => #t and (allpos ‘(0 1 2)) => #f 3 5 1 4...
View Full Document
- Spring '11
- Functional Programming, higher-order Scheme functions