Friday, June 18, 2010

SICP Exercise 1.4

Observe that our model of evaluation allows for combinations whose operators are compound expressions. Use this observation to describe the behavior of the following procedure:

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

The operation follows on the if a then result, else b where a and b are the + and - operators. This is essentially the old conditional operator in C.

No comments:

Post a Comment