SICP 习题2.21 square-list
来源:互联网 发布:如何防范sql注入式攻击 编辑:程序博客网 时间:2024/06/06 12:53
print-list的时候写了三个if,是个愚蠢的地方
(define (map-a proc items) (if (null? items) '() (cons (proc (car items)) (map-a proc (cdr items)))))(define nl newline)(define print-list (lambda (s) (if (not (null? s)) (display (car s))) (if (not (null? s)) (display " ")) (if (not (null? s)) (print-list (cdr s)))))(nl)(print-list (map-a abs '(-10 2.5 -11.6 17)))(define square (lambda (x) (* x x)))(define (square-list-a items) (if (null? items) '() (cons (square (car items)) (square-list-a (cdr items)))))(define (square-list-b items) (map-a square items)) (nl)(print-list (square-list-a '(1 2 3 4)))(nl)(print-list (square-list-b '(1 2 3 4)))
0 0
- SICP 习题2.21 square-list
- SICP 习题 (2.30)解题总结 : Square-Tree
- SICP 习题2.18 reverse-list
- sicp 习题2.21
- SICP 习题 (2.31)解题总结 : 通用的Square-Tree
- SICP 习题2.22 square迭代式写法的失败
- SICP习题
- SICP list
- sicp 第一章习题试做
- sicp 第一章 习题
- sicp 2.2 习题
- sicp 2.3-2.5 习题
- SICP 部分习题答案
- SICP 习题答案1.1
- SICP 习题答案1.2
- SICP 习题答案1.3
- SICP 习题答案1.4
- SICP 习题答案1.5
- [LeetCode]problem 60. Permutation Sequence
- E
- Exchange 2010 PS 之 Get-MessageTracking命令!
- HOJ 1020
- 【笔记】投影坐标到屏幕坐标
- SICP 习题2.21 square-list
- 文章标题
- 动态维护数列的中位数
- 进程、线程和协程的区别是什么
- 在jsp中设置cookie
- PHP对表单提交特殊字符的过滤和处理
- test
- 如何在OS X El Captain中配置GLFW和GLEW
- 面向对象设计方式的特性