1 (defvar tolerance 0.00001)
2 (defun fixed-point (f first-guess)
5 (< (abs (- v1 v2)) tolerance))
7 (let ((next (funcall f guess)))
8 (if (close-enough? guess next)
14 (defun dampen-sqrt (x)
20 (fixed-point (lambda (x) (1+ (/1 x))) 1.0)
22 (defvar tolerance 0.00001)
23 (defun fixed-point (f first-guess)
25 (close-enough? (v1 v2)
26 (< (abs (- v1 v2)) tolerance))
28 (format t "Trying ~F~%" guess)
29 (let ((next (funcall f guess)))
30 (if (close-enough? guess next)
37 (/ (log 1000) (log x)))
40 (print (fixed-point #'xx 2.0))
41 (print (fixed-point #'dampen-xx 2.0))