From Scheme and the art of programming: exercises 11.1, 11.5, 11.12, 12.1, 12.6, 12.10, and 13.5.
I'll use the term ``ampex'' for any Scheme procedure of arity 1 that takes any real number as argument and returns a real number as value. (Why ``ampex''? Because it represents a ``real-to-real'' function.)
Define a Scheme procedure ampex*
that takes two ampexes
(ampices?) as arguments and returns the product of the functions represent
as an ampex. In other words, ((ampex* f g) x)
should equal
(* (f x) (g x))
.
Define a Scheme procedure trapezoid
that takes as arguments an
ampex f
, a real lower bound a
, an real upper
bound b
, and an optional positive integer argument
pieces
and computes an approximation to the definite integral
of the function expressed by f
, from a
to
b
, by the trapezoidal method, dividing the interval from
a
to b
into the number of equal pieces specified
by pieces
(defaulting to 64).
Define a Scheme procedure list-set!
that takes three arguments
-- a list ls
, an integer n
with a value in the
range from 0 (inclusive) to the length of ls
(exclusive), and
obj
-- and mutates the argument ls
so that its
n
th element is obj
. (The value returned by the
procedure is unspecified.)
This document is available on the World Wide Web as
http://www.math.grin.edu/~stone/events/scheme-workshop/Thursday-exercises.html