<< Previous exercise (3.72) | Index | Next exercise (3.74) >>

meteorgan

(define (RC r c dt) (define (proc i v) (add-streams (scale-stream i r) (integral (scale-stream i (/ 1 c)) v dt))) proc)

mathieuborderé

@meteorgan I think it's better to just return a lambda, naming the function in the example before the actual exercise was necessary to recursively call it, here it's not needed.

Beckett

(define (RC r c dt) (lambda (si initial-voltage) (add-stream (scale-stream si R) (integral (scale-stream si (/ 1 C)) initial-voltage dt))))

`(define (RC r c dt) (define (proc i v) (add-streams (scale-stream i r) (integral (scale-stream i (/ 1 c)) v dt))) proc)`

mathieuborderé

@meteorgan I think it's better to just return a lambda, naming the function in the example before the actual exercise was necessary to recursively call it, here it's not needed.

Beckett

`(define (RC r c dt) (lambda (si initial-voltage) (add-stream (scale-stream si R) (integral (scale-stream si (/ 1 C)) initial-voltage dt))))`