2016-11-01から1ヶ月間の記事一覧

SICPゼミ第32回

練習問題3.81 (define (rand-stream stream) (define (rand-stream-iter stream mt) (if (stream-null? stream) the-empty-stream (let ((message (stream-car stream))) (if (eq? message 'generate) (cons-stream (mt-random-integer mt 1000) (rand-strea…

SICPゼミ第31回

練習問題3.77 (define (integral delayed-integrand initial-value dt) (cons-stream initial-value (let ((integrand (force delayed-integrand))) (if (stream-null? integrand) the-empty-stream (integral (delay (stream-cdr integrand)) (+ (* dt (str…

SICPゼミ第30回

練習問題3.73 (define (RC R C dt) (define (calc i v0) (add-streams (scale-stream i R) (integral (scale-stream i (/ 1 C)) v0 dt))) calc) 民主主義しゅき〜〜(ドナルド・トランプ) 練習問題3.74 (define (sign-change-detector now last) (if (> (* …

SICPゼミ第29回

練習問題3.67 (define (pairs s t) (cons-stream (list (stream-car s) (stream-car t)) (interleave (interleave (stream-map (lambda (x) (list (stream-car t) x)) (stream-cdr s)) (stream-map (lambda (x) (list x (stream-car t))) (stream-cdr s))) (…