Hatena::Groupsicp

SICP読書記

 | 

2009-12-14

問題 3.50

問題 3.50 - SICP読書記 を含むブックマーク はてなブックマーク - 問題 3.50 - SICP読書記

(use util.stream)

(define (display-stream stream)
  (if (stream-null? stream)      (undefined)      (begin         (display (stream-car stream))        (display "\n")
        (display-stream (stream-cdr stream)))))


(define (stream-map proc . argstreams)
  (if (stream-null? (car argstreams))
          stream-null
          (stream-cons
                (apply proc (map stream-car argstreams))
                (apply stream-map
                           (cons proc (map stream-cdr argstreams))))))

(display-stream
 (stream-map + 
        (stream 1 2 3)
        (stream 40 50 60)
        (stream 700 800 900)))

TrishaTrisha2011/04/10 18:192YOG4g Great thinking! That really breaks the mold!

idmooddwagbidmooddwagb2011/04/12 04:42kPLDem <a href="http://jnxznjbewwui.com/">jnxznjbewwui</a>

eizyabbreizyabbr2011/04/13 07:056iMrjp , [url=http://wvvbuylirhkh.com/]wvvbuylirhkh[/url], [link=http://aebieveibhev.com/]aebieveibhev[/link], http://mtrjxksgirct.com/

 |