Gsong's Blog
Developer + Entrepreneur = Entreveloper
SICP 연습문제 풀이 1.36
[CODE](define (fixed-point f first-guess) (define (close-enough? v1 v2) (display v1) (newline) (< (abs (- v1 v2)) tolerance)) (define (try guess) (let ((next (f guess))) (if (close-enough? guess next) next (try next)))) (try first-guess)) (define tolerance 0.00001)[/CODE]...
SICP 연습문제 풀이 1.35
f(x) = 1 + 1/x일때 fixed point transformaiton 을 하면f(x) = x-> 1 + 1/x = x 양변에 x 를 곱해서x + 1 = x^2 golden ration phi 는 위 식을 만족시키는 값이다. 증명끝.
SICP 스터디 연습문제 풀이 1.34
> (f f). procedure application: expected procedure, given: 2; arguments were: 2> 이런 에러가 난다. (f f)-> (f 2)-> (2 2) 가 되어 위의 에러가 난다.
SICP 연습문제 풀이 1.33
[CODE](define (filter-accumulate filter combiner null-value term a next b) (define (iter a result) (if (> a b) result (iter (next a) (combiner result (if (filter a) ...
SICP 연습문제 풀이 1.32
[CODE]; Recursive(define (accumulate combiner null-value term a next b) (if (> a b) null-value (combiner (term a) (accumulate combiner null-value term (next a) next b)))) ; Iterative(define (accumulate combiner null-value term a next b) (define (iter a result) (if (> a b) ...
SICP 연습문제 풀이 1.31
a. [CODE]; Recursive(define (product-r term a next b) (if (> a b) 1 (* (term a) (product-r term (next a) next b)))) ; Iterative(define (product term a next b) (define (iter a result) (if (> a b) result (iter...
SICP 연습문제 풀이 1.30
[CODE](define (sum term a next b) (define (iter a result) (if (> a b) result (iter (next a) (+ result (term a))))) (iter a 0)) (define (term a) a)(define (next a) (+ a 1))[/CODE]
SICP 연습문제 풀이 1.29
[CODE](define (integral f a b n) (define (h) (/ (- b a) n)) (define (y k) (f (+ a (* k (h))))) (define (integral-function i) (* (/ (h) 3) (* (y i) (cond ((or (= i 0) (= i n)) 1) ...
SICP 연습문제 풀이 1.28
Miller-Rabin test 가 잘 이해 안되서 풀다 말았습니다. 나중에 찬찬히 다시 봐야겠습니다.
SICP 연습문제 풀이 1.27
(define (square x) (* x x)) (define (expmod base exp m) (cond ((= exp 0) 1) ((even? exp) (remainder (square (expmod base (/ exp 2) m)) m)) ...