projects
/
sicp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e185c7f
)
rest of section 1.3
author
Ramakrishnan Muthukrishnan
<vu3rdd@gmail.com>
Thu, 27 May 2010 12:46:25 +0000
(18:16 +0530)
committer
Ramakrishnan Muthukrishnan
<vu3rdd@gmail.com>
Thu, 27 May 2010 12:46:25 +0000
(18:16 +0530)
src/sicp/ch1_3.clj
patch
|
blob
|
history
diff --git
a/src/sicp/ch1_3.clj
b/src/sicp/ch1_3.clj
index 5aaf159db314c146bdf1e862fb278a5a787acc45..355cdc416f5f978cffac121376fcda5606a01054 100644
(file)
--- a/
src/sicp/ch1_3.clj
+++ b/
src/sicp/ch1_3.clj
@@
-129,4
+129,17
@@
(defn newton-sqrt [x]
(newton-method (fn [y] (- (square y) x))
- 1.0))
\ No newline at end of file
+ 1.0))
+
+(defn fixed-point-of-transform [g transform guess]
+ (fixed-point (transform g) guess))
+
+(defn sqrt1 [x]
+ (fixed-point-of-transform (fn [y] (/ x y))
+ average-damp
+ 1.0))
+
+(defn sqrt2 [x]
+ (fixed-point-of-transform (fn [y] (- (square y) x))
+ newton-transform
+ 1.0))
\ No newline at end of file