【发布时间】:2018-06-20 23:21:57
【问题描述】:
在运行一段代码后,我得到以下输出(一对单独的两个列表):
("a") ("a")
如何将这对列表合并为一个? 即我想要以下输出:
("a" "a")
为了澄清,我的代码是:
(defun c:TEST ()
(setq a (ssget)); I select a line here
(setq b (assoc 8 (entget (ssname a 0)))); gets me all dotted pairs containing 8
(setq c (list (cdr b))); gets second elements of each pair (strings in this case) and converts them to two separate lists
(print c)
)
【问题讨论】:
-
使用
APPEND将多个列表追加到一个列表中。 -
函数如何返回多个列表?
-
你确定第一个
("a")不是打印出来的(c),第二个和返回值一样吗? -
我在这里和@Sylvester 在一起;单个
(print c)不会产生两个值。printf函数 returns the leftmost argument value is it passed 等如果它是函数的最后一个表达式,则该函数将返回打印的任何内容。如果您从某个交互式侦听器(“REPL”或“read-eval 打印循环”)运行该函数,您将看到打印的输出和再次打印的返回值。 -
我很笨。你是对的。我觉得我好笨。谢谢!如何标记为已解决?