| Programming languages should be designed not by piling feature on top of feature, but by removing the weaknesses and restrictions that make additional features appear necessary. Scheme demonstrates that a very small number of rules for forming expressions, with no restrictions on how they are composed, suffice to form a practical and efficient programming language that is flexible enough to support most of the major programming paradigms in use today. IEEE Scheme 编程语言标准 [24],第 3 页 |
表达式来命名过程。4 例如,对其输入求平方的过程可以写作:
(lambda (x) (* x x))
表达式的一般形式为
(lambda formal-parameters body)
表达式的地方使用符号 pi 和 square。例如,半径为 5 米的球体表面积为
(* 4 pi (square 5))
表示法,用于指定一个具有命名参数的匿名函数:
x [ 关于 x 的表达式 ]。这读作:
5 这里给出的 square 定义并非 Scmutils 系统中 square 的定义。在 Scmutils 中,square 被扩展用于多元组,表示该多元组各分量平方和。然而,对于非多元组的参数,Scmutils 中的 square 确实会将参数与其自身相乘。
6 示例通过缩进提高可读性。Scheme 不关心多余的空白,因此我们可以根据需要添加尽可能多的空白以使代码更易于阅读。
7 这些名称是历史的偶然。它们分别代表 IBM 704 计算机“寄存器的地址部分内容”和