each of the following two procedures defines a


Each of the following two procedures defines a method for adding two positive integers in  terms of the procedures inc, which increments its argument by 1, and dec, which decrements its argument by 1:

(define (plus1 a b)

(if (= a 0)

b

(inc (plus1 (dec a) b))))

(define (plus2 a b)

(if (= a 0)

b

(plus2 (dec a) (inc b))))
 
Using the substitution model, illustrate the process generated by each procedure in evaluating (+ 2 5). Are these processes iterative or recursive?

Request for Solution File

Ask an Expert for Answer!!
Application Programming: each of the following two procedures defines a
Reference No:- TGS0218465

Expected delivery within 24 Hours