emacs - &rest 在 elisp 中是什么意思?

标签 emacs lisp elisp

&rest 是什么意思:(append &rest sequences)

我读完了《elisp_intro》这本书,但我没有找到答案。如果你能帮助我,我将不胜感激。

最佳答案

表示后面的参数是“rest”参数。对于您的示例,sequences 是其余参数。

与普通参数不同,剩余参数将消耗用户提供的任何参数的“剩余”部分。这是一种制作接受可变数量参数的函数的方法。在函数体内,参数将是一个包含所有额外参数的列表。

因此,如果您有一个看起来像 (add &rest numbers) 的函数,那么您可以像 (add 1 2 3 4 5) 那样调用它,并且在numbers 参数的函数值为 (1 2 3 4 5)

或者例如,((lambda (a &rest r) r) 1 2 3) ;=> (2 3)

关于emacs - &rest 在 elisp 中是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4970111/

相关文章:

Emacs 模式 : "Command attempted to use minibuffer while in minibuffer"

user-interface - LTK:删除 Entry 小部件中的字符回显

python - 在 Hy 中创建对象

emacs - Emacs —如何创建垂直删除线效果

Emacs:我可以更改已启动进程的名称吗?

emacs 术语模式中的 Unicode 字符

emacs - 如何保存工程日志

emacs - Emacs 24.4.1 中的下标未正确显示

scheme - 错误 : (/) bad argument type: #<unspecified> Chicken Scheme Square root approximation

python - 在 Emacs 中配置新模式 : installing python-mode. el