【SICP练习】127 练习3.58
来源:互联网 发布:logo图形设计软件 编辑:程序博客网 时间:2024/06/05 00:55
练习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
5 0
- 【SICP练习】127 练习3.58
- 【SICP练习】2 练习1.6
- 【SICP练习】3 练习1.7
- 【SICP练习】4 练习1.8
- 【SICP练习】5 练习1.9
- 【SICP练习】6 练习1.10
- 【SICP练习】7 练习1.11
- 【SICP练习】8 练习1.12
- 【SICP练习】9 练习1.15
- 【SICP练习】10 练习1.16
- 【SICP练习】11 练习1.17
- 【SICP练习】12 练习1.18
- 【SICP练习】13 练习1.19
- 【SICP练习】14 练习1.20
- 【SICP练习】15 练习1.21
- 【SICP练习】16 练习1.22
- 【SICP练习】17 练习1.23
- 【SICP练习】18 练习1.24
- DDD领域驱动设计
- HDU 5194 DZY Loves Balls(排列组合瞎搞 )
- C#非托管资源
- (五)Support Vector Machines[支持向量机]
- IOS开发之多线程与GCD
- 【SICP练习】127 练习3.58
- linux系统在虚拟机上不能使用桥接模式
- 题目:最简单的逆向
- vs2013中静态库lib文件的生成与使用
- android 图形特效处理 Matrix控制变换
- Restore
- Android信息存储之 json
- zoj 2102 - Tables
- 程序员面试笔记5---类