上一页 1 2 3 4 5 6 ··· 8 下一页

2015年4月8日

SICP:2,4 序对的过程性表示方法

摘要: Here are the fully expand steps:0) at the beginning , we get expression ``(car (cons 1 2))``1) replace ``cons`` using ``(lambda (m) (m x y))`` , we ge... 阅读全文

posted @ 2015-04-08 22:52 Zachary_wiz 阅读(128) 评论(0) 推荐(0) 编辑

2015年4月4日

SICP:1.43重复调用函数

摘要: #lang racket(define (repeated f n) (define (compare f1 f2) (lambda(x) (f1 (f2 x)));lambda );compare (define (doing result n) (if (= ... 阅读全文

posted @ 2015-04-04 19:21 Zachary_wiz 阅读(235) 评论(0) 推荐(0) 编辑

SICP:1.41 double过程

摘要: #lang racket(define (double f) (lambda (x) (f (f x)) );lambda );double(define ((double1 f) x) (f (f x)) )(define (inc x) (+ x 1) );inc(((d... 阅读全文

posted @ 2015-04-04 16:43 Zachary_wiz 阅读(203) 评论(0) 推荐(0) 编辑

SICP: 第一章 之 牛顿法

摘要: #lang racket(define (newton-transform g) (define dx 0.00001) (define (deriv g) (lambda (x) (/ (- (g (+ x dx)) (g x)) dx) );lambda );de... 阅读全文

posted @ 2015-04-04 11:07 Zachary_wiz 阅读(176) 评论(0) 推荐(0) 编辑

2015年3月29日

SICP:1.37 递归/迭代求无穷连分式

摘要: #lang racket(define (cont-frac N D k) (define (cf t) (if (= t 1) (/ (N t) (D t)) (/ (N t) (+ (D t) (cf (- t 1)))) );if );cf (cf k) )... 阅读全文

posted @ 2015-03-29 13:41 Zachary_wiz 阅读(239) 评论(0) 推荐(0) 编辑

SICP:求函数的不定点来实现开平方根(由于使用平均阻尼技术,过程类似牛顿开平方根,以及求黄金分割率)

摘要: #lang racket(define tolerance 0.00001);公差(define (fixed-point f first-guess) (define (close-enough? v1 v2) (< (abs (- v1 v2)) tolerance) );clos... 阅读全文

posted @ 2015-03-29 10:05 Zachary_wiz 阅读(281) 评论(0) 推荐(0) 编辑

2015年3月28日

SICP:1.31按照公式求Pi值,原理同1.29

摘要: #lang racket;product doing the multiplation(define (product term a next b) (if (< b a) 1 (* (term a) (product term (next a) next b)) ... 阅读全文

posted @ 2015-03-28 17:11 Zachary_wiz 阅读(160) 评论(0) 推荐(0) 编辑

2015年3月26日

SICP:1.29辛普森公式求积分

摘要: 使用simpson公式求积分#lang racket;this function is use recursive(define (sum term a next b) (if (> a b) 0 (+ (term a) (sum term (next a) next... 阅读全文

posted @ 2015-03-26 21:57 Zachary_wiz 阅读(185) 评论(0) 推荐(0) 编辑

2015年3月23日

SICP:1.19快速的求Fib数列

摘要: #lang racket(define (fib n) (fib-iter 1 0 0 1 n) );fib(define (fib-iter a b p q count) (cond ((= count 0) b);0 ((even? count) (fib-iter a ... 阅读全文

posted @ 2015-03-23 20:50 Zachary_wiz 阅读(189) 评论(0) 推荐(0) 编辑

2015年3月21日

SICP:反复用加法来实现乘法 1.17

摘要: #lang racket(define (fast-multiplication a b n);a*n (cond ((= n 0) b);n==0 ((even? n) (fast-multiplication (double a) b ... 阅读全文

posted @ 2015-03-21 14:30 Zachary_wiz 阅读(122) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 ··· 8 下一页

导航