"SICP Exercise" 142 Exercise 3.77

Source: Internet
Author: User

Exercise 3-77 Original

Exercise 3.77. The integral procedure used above was analogous to the "implicit" definition of the infinite stream of integers 3.5.2. Alternatively, we can give a definition of integral that's more like Integers-starting-from (also in section 3.5. 2):

(Define (integral integrand initial-value DT)   (cons-stream initial-value (if (stream-null integrand) /c5> the-empty-stream (integral (stream-cd R integrand)(+ (* DT (stream-car integrand) ) (initial-value) dt  ))))

When used on systems with loops, this procedure have the same problem as does our original version of integral. Modify the procedure so, it expects the integrand as a delayed argument and hence can be used in the solve procedure s Hown above.

Code
 (Define (integral delayed-integrand initial-value DT)          (Cons-streamInitial-value( Let (integrand   (Force Delayed-integrand))                          (if (stream-null integrand) The-empty-stream (integral ( stream-cdr integrand)) ( c13>+ (* DT (stream-car integrand)) initial-value) ( DT)) ))) 

"SICP Exercise" 142 Exercise 3.77

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.