有没有一种方法可以提取列表中的所有元素 [英] Is there a way to extract all elements of a list in place

查看:114
本文介绍了有没有一种方法可以提取列表中的所有元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种提取通用Lisp中列表的所有元素的方法.像这样

Im looking for a way to extract all the elements of a list in common lisp. Like this

[194]> (break-out-of-list '(a b c d))
A
B
C
D

我给的用法示例没有得到很好的考虑,但是我仍然很好奇是否有可能像上面的示例那样脱离列表.

The usage example I gave was not thought out very well, however I'm still curious if it is possible to break out of a list like in the example above.

推荐答案

您展示的似乎是一个问题,如何将列表的元素作为多个值 :

What you demonstrate seems to be the question how to get the elements of a list as multiple values:

CL-USER> (values 1 2 3)
1
2
3
CL-USER> (apply #'values '(1 2 3))
1
2
3

另请参阅超级规格中的multiple-value-bindnth-value.

See also multiple-value-bind and nth-value in the hyperspec.

这篇关于有没有一种方法可以提取列表中的所有元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆