更新时间:2023-11-24 17:44:10
与计划时,Emacs Lisp是一个的 2口齿不清的,这意味着每个符号有两个独立的绑定:值绑定和功能结合。在函数调用(ABCD)
,第一个符号( A
)的查找使用功能绑定,其余( BCD
)的查找使用值绑定。特殊的形式让
创建一个新的(本地)值绑定, FLET
创建一个新的功能结合。
Unlike Scheme, Emacs Lisp is a 2-lisp, which means that each symbol has two separate bindings: the value binding and the function binding. In a function call (a b c d)
, the first symbol (a
) is looked up using a function binding, the rest (b c d
) are looked up using the value binding. Special form let
creates a new (local) value binding, flet
creates a new function binding.
请注意该值或功能用于查找绑定是否在(ABCD)
函数调用依赖于的位置的,而不是在键入的看着的向上价值。特别是,一个值绑定可以解析功能
Note that whether value or function binding is used for lookup depends on the position in the (a b c d)
function call, not on the type of the looked-up value. In particular, a value binding can resolve to function.
在你的第一个例子,你的功能绑定˚F
(通过 FLET
),然后做一个函数查找
In your first example, you function-bind f
(via flet
), and then do a function lookup:
(f ...)
在你的第二个例子,你值绑定˚F
来的函数(通过让
),然后用一个值查找:
In your second example, you value-bind f
to a function (via let
), and then use a value lookup:
(... f ...)
因为你用同样的在各种情况下具有约束力和查找里工作。
Both work because you use the same kind of binding and lookup in each case.
http://en.wikipedia.org/wiki/Common_Lisp#Comparison_with_other_Lisps