1.4 Exercise 1.4

This procedure adds the absolute value of b to a. To do this, it selects the operation to apply on a with b based on whether b is greater than 0. If b > 0, then b = abs(b) and can be added to a. Otherwise, -b = abs(b) and so a - b = a + abs(b). Note that -b = abs(b) for the case where b = 0.

(define (a-plus-abs-b a b)
  ((if (> b 0) + -) a b))