The exercise asks us to describe the behavior of the given procedure:
(define (a-plus-abs-b a b) ((if (> b 0) + -) a b))
The return value of the procedure can be described as follows
This is because the expression (if (> b 0) + -)
evaluates the predicate (> b 0)
and if it is true, returns the operator +
, else, returns the operator -
.
Or more simply, a + abs(b); as hinted by the name of the function. xD
That is not an explanation for the given procedure. 😛
Show some basic code manipulations?
to
to
OT: Scheme programmers use 2-space tabs normally.