Hatena::Grouphokudaisicp

TSBの日記

2008-12-01

1.3 --- 1-44 途中

| 17:56

(define (3heikin a b c) (/ (+ a b c) 3))

(define (inc x) (+ x 1))

(define (square x) (* x x))

(define (compose proc2 proc1) (lambda(x) (proc2 (proc1 x)) ) )

(define (repeated proc num) (

if(> num 0) (lambda(x) ( (repeated proc (- num 1)) (proc x) ) )

(lambda(x) x) ))

(define dx 0.000001)

(define (smooth f) (lambda(x) (3heikin (f (+ x dx)) (f x) (f (- x dx)) ) ))

(print ( (smooth square) 10))

(print ( (repeated (smooth square) 5) 10))

1.3 --- 1-43

| 17:24

(define (inc x) (+ x 1))

(define (square x) (* x x))

(define (compose proc2 proc1) (lambda(x) (proc2 (proc1 x)) ) )

(define (repeated proc num)

(

if(> num 0) (lambda(x) ( (repeated proc (- num 1)) (proc x) ) )

(lambda(x) x)

)

)

(print ( (repeated square 3) 5))

以上のやつはだめみたい。

procが重なってない。

単純に計算を逐次的にやってるように見えるだけ?

1.3 --- 1-42

| 16:34

(define (inc x) (+ x 1))

(define (square x) (* x x))

(define (compose proc2 proc1) (lambda(x) (proc2 (proc1 x)) ) )

(print ( (compose square inc) 6) )

1.3 --- 1-41

| 16:29

(define (inc x) (+ x 1) )

(define (double f) (lambda(x) (f (f x) )))

(print (((double (double double)) inc) 5) )

ゲスト



トラックバック - http://hokudaisicp.g.hatena.ne.jp/TSB/20081201