(define (+ a B)/> (if (= a 0) b (inc (+ dec a) B)/>)))
And like this:
(define (+ a B)/> (if (= a 0) b (+ (dec a) (inc B)/>)))
EDIT: It keeps capitalizing the "B" in my code snippets for some reason. It really does not matter to the question I am asking but just pointing it out.
I have to write out the steps of the evolutions of the evaluation of (+ 4 5) for both definitions of "+". I was able to follow some examples the professor gave in class and figured out how to do the evolution of the first definition. This is how I did it:
(+ 4 5) (inc (+ 3 5)) (inc (inc (+ 2 5))) (inc (inc (inc (+ 1 5)))) (inc (inc (inc (inc (+ 0 5))))) (inc (inc (inc (inc 5)))) (inc (inc (inc 6))) (inc (inc 7)) (inc 8) 9
I need some guidance on how do it with the second definition. Examples, the first few lines, or anything would be helpful.
Thanks in advance.
This post has been edited by mattlyons: 06 September 2011 - 07:02 AM