Created
October 29, 2019 14:57
-
-
Save chelseatroy/258127ddc577bad6ab5f3157cdfb68cb to your computer and use it in GitHub Desktop.
Iterative Function
This file contains 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 (sum-i n) | |
(define (iter n sofar) | |
(if (= n 0) | |
sofar | |
(+ (iter (- n 1) (+ n sofar))))) | |
(iter n 0) | |
) | |
(sum-i 5) ; 15 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment