更新时间:2022-03-22 23:06:46
Common Lisp通常不对表达式的第一个元素求值.它必须是为函数命名的文字符号或lambda表达式.
Common Lisp doesn't evaluate the first element of an expression normally. It has to be either a literal symbol naming a function, or a lambda expression.
If you want to call a function determined dynamically, you need to use the FUNCALL
function:
(funcall (if t 'format) t "test")
这类似于在Ruby中使用.call()
方法的需要.
This is analogous to the need to use the .call()
method in Ruby.
您尝试过的方法可以在其他Lisp方言中使用,例如Scheme.
What you tried would work in some other Lisp dialects, such as Scheme.