Common Lisp - 列出拆包?(类似于Python)

bri*_*dum 16 lisp python list common-lisp iterable-unpacking

在Python中,假设定义了以下函数:

def function(a, b, c):
    ... do stuff with a, b, c ...
Run Code Online (Sandbox Code Playgroud)

我可以使用Python的序列解包来使用该函数:

arguments = (1, 2, 3)
function(*arguments)
Run Code Online (Sandbox Code Playgroud)

Common Lisp中是否存在类似的功能?如果我有一个功能:

(defun function (a b c)
    ... do stuff with a, b, c ...
Run Code Online (Sandbox Code Playgroud)

如果我有3个元素的列表,我可以轻松地使用这3个元素作为函数的参数?

我目前实现它的方式如下:

(destructuring-bind (a b c) (1 2 3)
    (function a b c))
Run Code Online (Sandbox Code Playgroud)

有没有更好的办法?

nom*_*olo 22

使用apply功能:

(apply #'function arguments)
Run Code Online (Sandbox Code Playgroud)

例:

CL-USER> (apply #'(lambda (a b c) (+ a b c)) '(1 2 3))
6   
Run Code Online (Sandbox Code Playgroud)