# JavaScript和SICP

(define (sqrt x)
(define (good-enough? guess)
(< (abs (- (square guess) x)) 0.001))
(define (improve guess)
(average guess (/ x guess)))
(define (sqrt-iter guess)
(if (good-enough? guess)
guess
(sqrt-iter (improve guess))))
(sqrt-iter 1.0))

//Newton's method to find /sqrt{x}
function sqrt(x){
function sqrt_iter(guess){
if(good_enough(guess)){
return guess;
}

return sqrt_iter(improve(guess));
}

function improve(guess){
return average(guess, x/guess);
}

function average(x, y){
return (x + y)/2;
}

function good_enough(guess){
return Math.abs(guess * guess - x) < 0.001;
}

return sqrt_iter(1.0);
}

#### SICP 2.2 嵌套映射

2017-01-17 22:50:46

#### javascript键值映射

2016-03-01 19:13:42

#### 进一步理解 javascript对象、数组、映射和哈希表

2011-12-13 11:52:46

#### JS映射

2010-04-15 16:15:00

#### 【JS】Array.forEach(遍历) Array.map(映射)

2014-03-20 17:28:06

#### SICP Python 描述 翻译完成

2016-09-12 17:01:43

#### SICP 习题 (1.6) 解题总结：对if语句的特殊处理

2013-08-14 06:58:01

#### SICP学习小结

2015-04-13 18:57:33

#### SICP 折腾之开发环境

2014-11-01 10:43:27

#### sicp in python

2017-05-08 21:25:01