我如何编写一个函数,它有两个列表的参数并返回 连接两个列表,不使用追加。
I know how to get the head of the second list but I don't know how to put it in the first one and what should I do if the head of the list is also a list.
最佳答案
是否允许使用 LOOP 或 DO?
像这样的东西会起作用:
(defun my-concat (x y)
(loop
for o in (reverse x)
do (push o y)
finally (return y)))
如果循环不是一个选项,您可能想使用递归。
关于list - lisp 列表连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15267665/