2013年8月21日水曜日

開発環境

計算機プログラムの構造と解釈(Gerald Jay Sussman(原著)、Julie Sussman(原著)、Harold Abelson(原著)、和田 英一(翻訳)、ピアソンエデュケーション、原書: Structure and Interpretation of Computer Programs (MIT Electrical Engineering and Computer Science)(SICP))の3(標準部品化力, オブジェクトおよび状態)、3.5(ストリーム)、3.5.4(ストリームと遅延評価)、問題 3.80を解いてみる。

その他参考書籍

問題 3.80

コード(BBEdit)

sample.scm

(define (RLC R L C dt)
  (lambda (vc0 il0)
    (define vC (integral (delay dvC) vC0 dt))
    (define iL (integral (delay diL) iL0 dt))
    (define dvC (stream-scale iL (/ -1 C)))
    (define diL (add-streams (stream-scale vC (/ 1 L))
                             (stream-scale iL (/ (* -1 R)
                                                 L))))
    (cons vC iL)))

(define RLC1 (RLC 1 1 0.2 0.1))

0 コメント:

コメントを投稿