zoukankan      html  css  js  c++  java
  • 【SICP练习】120 练习3.51

    练习3-51

    原文

    Exercise 3.51. In order to take a closer look at delayed evaluation, we will use the following procedure, which simply returns its argument after printing it:

    (define (show x) 
       (display-line x) 
       x)

    What does the interpreter print in response to evaluating each expression in the following sequence?

    (define x (stream-map show (stream-enumerate-interval 0 10))) (stream-ref x 5) 
    (stream-ref x 7)
    

    代码

    (define (show x)
      (display-line x)
      x)
    
    (define x (stream-map show (stream-enumerate-interval 0 10)))
    
    0
    ;Value: x
    
    (stream-ref x 5)
    
    1
    2
    3
    4
    5
    
    ;Value: 5
    
    (stream-ref x 7)
    
    6
    7
    ;Value: 7



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


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


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

  • 相关阅读:
    LOJ1036
    LOJ10132
    LOJ10131暗的连锁
    LOJ10128. 花神游历各国
    spoj 694(后缀数组)
    hdu 2459 (后缀数组+RMQ)
    hdu 3948(后缀数组+RMQ)
    ural 1297(后缀数组+RMQ)
    RMQ(dp)
    hdu 3518(后缀数组)
  • 原文地址:https://www.cnblogs.com/NoMasp/p/4786080.html
Copyright © 2011-2022 走看看