Skip to content

Instantly share code, notes, and snippets.

@manishym
Created December 18, 2011 15:49
Show Gist options
  • Save manishym/1493750 to your computer and use it in GitHub Desktop.
Save manishym/1493750 to your computer and use it in GitHub Desktop.
Square root using new-if
(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