Created
May 29, 2018 15:25
-
-
Save Edmundworks/b1946a8ae46ea69042e260d69359d535 to your computer and use it in GitHub Desktop.
sicp 1.1 iterative
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (f n) | |
(f-iter 0 1 2 n) | |
define (f-iter a b c count) | |
(cond (= count 0) a) | |
(= count 1) b) | |
(= count 2) c) | |
else f-iter b c (+c (* 2 b) (* 3 a) (- count 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment