gpt4 book ai didi

emacs - Emacs Lisp 中的 foldr、foldl 等价物是什么?

转载 作者:太空宇宙 更新时间:2023-11-03 18:32:26 28 4
gpt4 key购买 nike

Emacs Lisp 中的 foldr、foldl 等价物是什么?

最佳答案

如果你

(require 'cl)

然后你可以使用 Common Lisp 函数 reduce .为 foldr 传递关键字参数 :from-end t

ELISP> (reduce #'list '(1 2 3 4))
(((1 2) 3) 4)

ELISP> (reduce #'list '(1 2 3 4) :from-end t)
(1 (2 (3 4)))

关于emacs - Emacs Lisp 中的 foldr、foldl 等价物是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4244763/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com