home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d3xx
/
d385
/
xlispstat.lha
/
XLispStat
/
lisp.lzh
/
XLisp-Stat
/
Book
/
sqrt.lsp
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
Lisp/Scheme
|
1990-10-11
|
289 b
|
13 lines
; book p.83
(defun sqrt-iter (guess x)
(if (good-enough-p guess x)
guess
(sqrt-iter (improve guess x) x)))
(defun improve (guess x) (mean (list guess (/ x guess))))
(defun good-enough-p (guess x)
(< (abs (- (* guess guess) x)) .001))
(defun my-sqrt (x) (sqrt-iter 1 x))