(define (foo x y) (if (< x 0) (let ([z (+ x y 10)]) (- (* z z) 5)) (* y y))) |
(define (foo x y)(if (< x 0) (let ([z (+ x y 10)]) (- (* z z) 5)) (* y y))) (define ( foo x y ) ( if ( < x 0 ) (let ([ z (+ x y 10) ]) ( - ( * z z ) 5 )) (* y y ) ) ) ; end foo |
;;; This function implements the square search loop. ;;; It keeps improving an initial guess until the ;;; value is good enough. (define (try guess x) ;; If it's a good guess return it, otherwise, improve (if (good-enough? guess x) guess (try (improve guess x) x))) ; loop back #| (< 3.99 (try 2 0) 4.01) |# |