CHP2
(cond ...) 功能为判断;
(lambda (var...) exp) 创建一个含参数var...的过程,具体内容由exp决定;
(define var exp) 定义一个新变量,并把exp的求值结果赋给它;
规则一
在任何过程中,总是先判断是否为空表(null?)。
CHP3
规则二
使用cons构建列表(list)。
规则三
当构建列表(list)时,先拿到特有元素(typical element),然后cons它到传统递归(natural recursion)上。
(cons (car lat) (insertL new old (cdr lat)))
规则四
当递归时,至少要改变一个参数,并该参数要不断地向终止条件靠近,同时该参数要用于终止条件的判断中。
- 当使用cdr时,终止条件用null?;
- 当使用sub1时,终止条件用zero?;
The First Commandment: Always ask null? as the first question in expressing any function.
The Second Commandment: Use cons to build lists.
The Third Commandment: When building a list, describe the first typical element,and then cons is onto the natural recursion.
The Fourth Commandment: Always change at least one argument while recurring. It must be changed to be closer to termination. The changing argument must be tested int the termination condition; when using cdr, test termination with null?
CHP4
元组(tuple)
它是一个由数字组成的元素集合。
The Five Rules
The Ten Commandments
网友评论