【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


目录
相关文章
|
数据安全/隐私保护
|
数据安全/隐私保护