Exercise 1.4
The Question
Observe that our model of evaluation allows for combinations whose operators are compound expressions. Use this observation to describe the behaviour of the following procedure:
(define (a-plus-abs-b a b)
((if (> b 0) + -) a b))
The Answer
Adding a positive number and subtracting a negative number has the same effect
as adding the absolute value of a number. We are able to change the procedure as
observed. Thus +
is returned as the procedure if b
is greater than 0, and -
otherwise.