CS330 Spring 2004 Lecture 9
George Tzanetakis
Slides
This lecture will not contain any slides as it consists mainly of
programming examples in sml.
SML code
Code in text format
Suggested exercises
9.1) Using Int.toString and map write a function that converts a list
of integers to a list of corresponding strings.
9.2) Declare a function sum(p, xs) where p is a predicate of type
int->bool and
xs is a list of integers. The value of sum(p, xs) is the sum of the
elements
in xs satisfying the predicate p. Use foldr or foldl.
9.3)
A roommate service has a file (which you will model as a list of
records) containing
name, telephone number, email, year of birth and themes of interest for
each client. You may
make a request to the bureau stating your year of birth and
themes of interest
and get a responce listing all matching clients, i.e clients with a
deviation in age less than 10 yrs
and with at least one common theme of interest. The problem is to
contruct a program
for generating the responces from the roommate service given your
request. Use higher-order
functions for the solution to this exercise.