有时我需要遍历列表中的连续对.我现在这样做的方式是
(loop for x on lst while (not (null (cdr x)))
(do something on (car x) and (cadr x)))
Run Code Online (Sandbox Code Playgroud)
我想知道是否有更好/内置的方法来做到这一点.
我需要这个的原因有时是我想要的,例如一些添加连续对的函数
(1 2 3 4 5) ----> (3 5 7 9)
Run Code Online (Sandbox Code Playgroud)
是否有像reduce这样的内置函数可以让我得到这个?
common-lisp ×1