【SICP练习】127 练习3.58
生活随笔
收集整理的這篇文章主要介紹了
【SICP练习】127 练习3.58
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
練習3-58
原文
Exercise 3.58. Give an interpretation of the stream computed by the following procedure:
(define (expand num den radix) (cons-stream (quotient (* num radix) den) (expand (remainder (* num radix) den) den radix)))(Quotient is a primitive that returns the integer quotient of two integers.) What are the successive elements produced by (expand 1 7 10) ? What is produced by (expand 3 8 10) ?
分析
(expand 1 7 10) => (quotient (* 1 10) 7) => 1 => (expand (remainder 10 7) 7 10) => (quotient (* 3 10) 7) => 4 => (expand (remainder 30 7) 7 10) => (quotient (* 2 10) 7) => 2 …… …… => 1 4 2 8 5 7 4 2 8 5 7 ...(expand 3 8 10) …… …… => 3 7 5 0 0 0 ...感謝訪問,希望對您有所幫助。 歡迎關注或收藏、評論或點贊。
為使本文得到斧正和提問,轉載請注明出處:
http://blog.csdn.net/nomasp
版權聲明:本文為 NoMasp柯于旺 原創文章,如需轉載請聯系本人。
轉載于:https://www.cnblogs.com/NoMasp/p/4786073.html
總結
以上是生活随笔為你收集整理的【SICP练习】127 练习3.58的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CSS3学习之 animation 属性
- 下一篇: SOAP简单示例