Skip to content

Instantly share code, notes, and snippets.

@Edmundworks
Last active April 15, 2018 17:21
Show Gist options
  • Save Edmundworks/973df0f9192f852308c5845057646e14 to your computer and use it in GitHub Desktop.
Save Edmundworks/973df0f9192f852308c5845057646e14 to your computer and use it in GitHub Desktop.
SICP 1.9 final
A
(+ 4 5)
((if (= 4 0) 5 (inc (+ (dec 4) 5))))
(inc (+ (dec 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))))
9
This is a linear recursion
B
(+ 4 5)
(if (= 4 0) 5 (+ (dec 4) (inc 5)))
(+ (dec 4) (inc 5))
(+ (dec 4) 6)
(+ 3 6)
(+ 2 7)
(+1 8)
This is a linear itereation
the above repeats the process for (+ 3 6) then (+ 2 7) then (+ 1 8) then 9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment