【发布时间】:2011-05-09 11:36:05
【问题描述】:
在 lisp 中,一个符号可以同时绑定到一个值和一个函数。 例如,
符号 f 绑定到函数
(defun f(x)
(* 2 x))
符号 f 绑定到一个值
(setq f 10)
所以我写了这样的东西:
(f f)
=> 20
这样的功能有什么好处?
【问题讨论】:
-
参数和指向 Gabriel 的 Lisp-1/Lisp-2 论文的链接已经在 Separate Namespaces for Functions and Variables in Common Lisp versus Scheme 中讨论过
-
@Pete:感谢您的链接。我在发布我的问题之前搜索了这个主题,但不知何故我错过了这个。
标签: namespaces lisp