我想知道我们可以从现有列表中设置一个列表吗?
(setq example1 '(1 2 3))
(setq example2 '((caddr example1) (cadr example1) (car example1)))
我知道我的编写方式不会达到预期的结果,但是有没有办法实现该结果?以及如何实现?
感谢您的宝贵时间!
最佳答案
can we set a list from an already existing list?
当然可以,但我认为您仍然对何时引用 should be used 感到困惑。带引号的表达式内的任何内容都不会被求值。
为了使用 example1
的元素设置列表 example2
就足以构造一个包含该元素的列表,例如:
(setq example2 (list (caddr example1) (cadr example1) (car example1)))
关于list - 如何在 Common Lisp 中从现有列表中设置某些内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49599072/