CS2322
Laboratory Problem 17
Unlimited Functional Composition
In this problem we wish to develop an operator which will compose arbitrarily many monadic functions. It is suggested that you use the unrestricted lambda to define an operator compose-many. compose-many should have the form
(define compose-many
(lambda args
...))
and produce a function of one argument as a result which is the composition of all the argument functions in left-to-right order. This means that the functions must be evaluated in right-to-left order.
For example:
(compose-many f g h) ==> a function which is equivalent to
(f (g (h x)))
((compose-many 1+ 1+ 1+ 1+) 3) ==> 7
((compose-many sqrt abs sub1
(lambda (n) (* n n))) 0.6) ==> 0.8
Lab 17 Scheme Code