Skip to content

Instantly share code, notes, and snippets.

@Edmundworks
Created May 29, 2018 15:25
Show Gist options
  • Save Edmundworks/b1946a8ae46ea69042e260d69359d535 to your computer and use it in GitHub Desktop.
Save Edmundworks/b1946a8ae46ea69042e260d69359d535 to your computer and use it in GitHub Desktop.
sicp 1.1 iterative
(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