# SICP Exercise 1.06

Code

```
#lang racket
(require "common.scm")
(define (new-if predicate then-clause else-clause)
(cond (predicate then-clause)
(else else-clause)))
(define (improve guess x)
(average guess (/ x guess)))
(define (good-enough? guess x)
(< (abs (- (square guess) x)) 0.001))
(define (sqrt x)
(sqrt-iter 1.0 x))
(define (sqrt-iter guess x)
(new-if (good-enough? guess x)
guess
; the last argument
(sqrt-iter (improve guess x)
x)))
; tests
(new-if (= 1 1) #t #f)
(new-if (= 2 3) #t #f)
;(sqrt 2)
; process stops with "out of memory" error
```

Output

```
#t
#f
```

`new-if`

is a procedure. Its evaluation starts after evaluation of all
arguments, in contrast with the case of special form `if`

. The evaluation of
the last argument of `new-if`

in `sqrt-iter`

procedure causes infinite recursive calls.