【SICP练习】119 练习3.50

练习3-50

原文

Exercise 3.50. Complete the following definition, which generalizes stream-map to allow procedures that take multiple arguments, analogous to map in section 2.2.3, footnote 12.

(define (stream-map proc . argstreams)  
   (if (<??> (car argstreams))  
       the-empty-stream     
       (<??>      
        (apply proc (map <??> argstreams))  
        (apply stream-map          
            (cons proc (map <??> argstreams))))))

代码

(define (stream-map proc . argstreams)
  (if (stream-null? (car argstreams))
      the-empty-stream
      (cons-stream
       (apply proc (map stream-car argstreams))
       (apply stream-map
          (cons proc (map stream-cdr argstreams))))))
;Value: stream-map



感谢访问,希望对您有所帮助。 欢迎关注或收藏、评论或点赞。


为使本文得到斧正和提问,转载请注明出处:
http://blog.csdn.net/nomasp


版权声明:本文为 NoMasp柯于旺 原创文章,如需转载请联系本人。

posted @ 2015-03-28 21:44  nomasp  阅读(121)  评论(0编辑  收藏  举报