You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
1.1 KiB
110 lines
1.1 KiB
|
|
Exercise 1.43: If
|
|
f
|
|
is a numerical function
|
|
and
|
|
n
|
|
is a positive integer, then we can form the
|
|
|
|
n
|
|
|
|
th
|
|
|
|
|
|
repeated
|
|
application of
|
|
f
|
|
, which is defined to be the function whose value at
|
|
x
|
|
|
|
is
|
|
|
|
f
|
|
(
|
|
f
|
|
(
|
|
…
|
|
(
|
|
f
|
|
(
|
|
x
|
|
)
|
|
)
|
|
…
|
|
)
|
|
)
|
|
|
|
. For example, if
|
|
f
|
|
is the
|
|
function
|
|
|
|
x
|
|
↦
|
|
x
|
|
+
|
|
1
|
|
|
|
, then the
|
|
|
|
n
|
|
|
|
th
|
|
|
|
|
|
repeated application of
|
|
f
|
|
is
|
|
the function
|
|
|
|
x
|
|
↦
|
|
x
|
|
+
|
|
n
|
|
|
|
. If
|
|
f
|
|
is the operation of squaring a
|
|
number, then the
|
|
|
|
n
|
|
|
|
th
|
|
|
|
|
|
repeated application of
|
|
f
|
|
is the function that
|
|
raises its argument to the
|
|
|
|
|
|
2
|
|
n
|
|
|
|
-th
|
|
|
|
power. Write a procedure that takes as
|
|
inputs a procedure that computes
|
|
f
|
|
and a positive integer
|
|
n
|
|
and returns
|
|
the procedure that computes the
|
|
|
|
n
|
|
|
|
th
|
|
|
|
|
|
repeated application of
|
|
f
|
|
. Your
|
|
procedure should be able to be used as follows:
|
|
|
|
|
|
((repeated square 2) 5)
|
|
625
|
|
|
|
|
|
Hint: You may find it convenient to use compose from Exercise 1.42.
|
|
|