Guest User

Untitled

a guest
Feb 19th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. ;first snippet
  2. (define (+ a b)
  3. (if (= a 0)
  4. b
  5. (inc (+ (dec a) b))))
  6.  
  7. ;second snippet
  8. (define (+ a b)
  9. (if (= a 0)
  10. b
  11. (+ (dec a) (inc b))))
  12.  
  13.  
  14. ;recursive process generated by first procedure:
  15. (+ 4 5)
  16. (inc (+ 3 5))
  17. (inc (inc (+ 2 5)))
  18. (inc (inc (inc (+ 1 5))))
  19. (inc (inc (inc (inc (+ 0 5)))))
  20. (inc (inc (inc (inc 5))))
  21. (inc (inc (inc 6)))
  22. (inc (inc 7))
  23. (inc 8)
  24. 9
  25.  
  26.  
  27. ;iterative process generated by second procedure:
  28. (+ 4 5)
  29. (+ 3 6)
  30. (+ 2 7)
  31. (+ 1 8)
  32. (+ 0 9)
  33. 9
Add Comment
Please, Sign In to add comment