defun 50岁生日啦

https://ml.cddddr.org/lispnews/lispnews-19690301.html

1969年3月1日,MacLisp上引入了defun,沿用至今。

与现在的defun不同的是,老defun不但可以定义函数,也可以定义Fexpr和宏

在有defun之前,大家只能用defprop配合lambda进行定义(类似于Elisp的defalias)。

    1)"DEFUN" IS AN FSUBR USED TO DEFINE
FUNCTIONS. EXAMPLES ARE
    (DEFUN ONECONS (X) (CONS 1 X))
WHICH IS EQUIVALENT TO 
    (DEFPROP ONECONS 
        (LAMBDA (X) (CONS 1 X)
     EXPR)

AND (DEFUN SMASH FEXPR (L) (RPLACD L NIL))
 IS EQUIVALENT TO
    (DEFPROP SMASH 
        (LAMBDA (L) (RPLACD L NIL))
     FEXPR)

参考博文 https://g000001.cddddr.org/3760354800

8 个赞

全大写明显增加了我理解英文的难度,比如软件协议、xkcd、 New Yorker 的标题和 Common Lisp 的文档,当然十有八九是我英文水平比较低的缘故。

最开始写lisp的时候还没ascii这东西,电脑哪分什么大写小写的,lisp用dashed-word风格也是这原因

1967年才有ASCII标准,1958年就有lisp了。

我一度感觉那个年代的电脑上不支持小写字母…

不不,我感觉我在国外呆了那么久,碰到大写还是得一个一个读😅

ALGOL 60 就支持区分大小写了了解一下。

最知名的 LISP 1.5 (1962) 年一样是区分大小写的。数据(列表和原子)用大写,程序用小写。

LISP 1.5 以及 ALGOL 60 主流用的平台 IBM 360 的字符集 EBCDIC 是大小写敏感的。

MacLisp 的运行平台 DEC PDP-6 是低端机型,用的 DEC Sixbit 字符集不支区分大小写。

仅此而己。

另外,LISP 1.5 及原型比较接近 Lisp-1,定义函数用的是 define

When a symbol stands for a function, the situation is similar to that in which a symbol stands for an argument. When a function is recursive, it must be given a name. This is done by means of the form LABEL, which pairs the name with the function definition on the a-list. The name is then bound to the function definition, just as a variable is bound to its value.

In actual practice, LABEL is seldom used. It is usually more convenient to attach the name to the definition in a uniform manner. This is done by putting on the property list of the name, the symbolEXPR followed by the function definition. The pseudo-function define used at the beginning of this section accomplishes this. When apply interprets a function represented by an atomic symbol, it searches the p-list of the atomic symbol before searching the current a-list. Thus a define will override a LABEL.

The fact that most functions are constants defined by the programmer, and not variables that are modified by the program, is not due to any weakness of the system. On the contrary, it indicates a richness of the system which we do not know how to exploit very well.

而 LISP I 和 LISP 1.5 程序为什么倾向用大写⋯⋯是因为数据和程序是用 80 columns punch card 输入的。而 80 columns punch card 不好意思只有大写字母。

4 个赞

有意思的知识:grinning: