Created
March 15, 2013 01:34
-
-
Save yao2030/5166850 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(load "stream-map.ss") | |
(load "ex59") | |
(define (scale-stream s f) | |
(stream-map (lambda (x) (* x f)) s)) | |
(define (mul-series s1 s2) | |
(cons-stream (* (stream-car s1) | |
(stream-car s2)) | |
(add-streams | |
(scale-stream (stream-cdr s2) (stream-car s1)) | |
(mul-series (stream-cdr s1) s2)))) | |
(define x cosine-series) | |
(define y sine-series) | |
(define z (add-streams (mul-series x x) (mul-series y y))) | |
(define (print-stream s) | |
(if (empty-stream? s) | |
'done | |
(begin (display (stream-car s)) | |
(display " ") | |
(print-stream (stream-cdr s))))) | |
;; Yangyang Qq: 451107669 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment