Created
December 18, 2011 15:49
-
-
Save manishym/1493750 to your computer and use it in GitHub Desktop.
Square root using new-if
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 (new-if predicate then-clause else-clause) | |
(cond (predicate then-clause) | |
(else else-clause))) | |
(define (sqrt-iter guess x) | |
(new-if (good-enough? guess x) | |
guess | |
(sqrt-iter (improve guess x) | |
x))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment