【发布时间】:2017-03-19 14:04:05
【问题描述】:
在 lisp 中,我将列表附加为: (setq newlist (append (side a b)(this a b) (that a b) ))
这会将所有必需的列表附加为: (1 0 0 0 2 0 4 0 6 0) 但我想要的是这样的: ((1 0)(0 0)(2 0)(4 0)(6 0))
我应该怎么做才能获得所需的格式。请在 lisp 中发布代码示例。
【问题讨论】:
-
什么是
side、this、that? -
它似乎不是您要查找的附加信息。也许
(list '(side a b) '(this a b) '(that a b)))? -
@sds 方面,this 和that 是其他三个有列表的函数。像边包含:(1 0 0 0),这包含:(0 0 2 0),并且包含:(4 0 6 0)。当我附加它们时,我得到 (1 0 0 0 0 0 2 0 4 0 6 0) 但我需要的是 ((1 0) (0 0) (0 0 ) (2 0) (4 0) (6 0 ))
-
@Sylwester (list '(side ab) '(this ab) '(that ab)) 给出 list 和 (list (side ab) (this ab) (that ab) 中相同元素的集合) 给出这样的结果: ((1 0) (0 0 0 3) (0 0 4 0)) 但我需要的是 ((1 0) (0 0) ( 0 3) (0 0 ) (4 0) )。
-
函数不“包含”列表。他们可能退回他们。请编辑您的问题以包含我们在 cmets 中要求的其他信息。
标签: list recursion append lisp