一些 LISP 表达式对自身求值(例如 MIT-Scheme REPL,尽管 GNU Common Lisp 同意):
1 ]=> 3
;Value: 3
并且是正常形式。因此,表达式的求值(例如 (+ 2 1)
)可以恰本地称为转换为正常形式。这很好,因为这就是我一直以来正式理解评估的方式。
但是对于列表我们有麻烦了:
1 ]=> (list 3 2)
; Value 16: (3 2)
1 ]=> (3 2)
;The object 3 is not applicable.
;To continue, call RESTART with an option number:
; (RESTART 2) => Specify a procedure to use in its place.
; (RESTART 1) => Return to read-eval-print level 1.
我的想法是否正确:
- (many[0]) 个 LISP 没有(非空)列表的规范形式,并且
- (许多)LISP 不具有求值归约到范式的特性?
如果是这样,这是否与抽象重写系统等 PLT 中的形式主义有些矛盾?在 LISP 中捕获评估的替代形式有哪些?
[0] 或者更准确地说,是“大多数著名的 LISP”,例如 CL、Clojure 和 Scheme。但我会对鲜为人知的反例感兴趣!
最佳答案
Lisp 只能根据几个原始运算符来定义。 How many primitives does it take to build a LISP machine? Ten, seven or five?因此,您可以认为从扩展到它们所获得的内容有一个正常形式。
但是 Lisp 不是 lambda 演算。 What type of lambda calculus would Lisp loosely be an example of?
和Lisp wasn't designed to be like the lambda calculus :
To use functions as arguments, one needs a notation for functions, and it seems natural to use the lambda-notation of Church. I didn’t understand the rest of the book, so I wasn’t tempted to try to implement his more general mechanism for defining functions.
-- History of Lisp, Stanford AI Laboratory memo 1979 by J. McCarthy, page 6
关于LISP 列表和范式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42166825/