Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个列表,例如下面给出的列表。但是,我的目标是使它像下面的列表一样,列表中没有额外的列表。
Given: [[[[1,0,2,3],[0,1,2,3]],[[2,1,0,3],[0,1,2,3]]]] Desired: [[[1,0,2,3],[0,1,2,3]],[[2,1,0,3],[0,1,2,3]]]
我试过 flatten、append 和其他各种谓词似乎无法做到这一点。
代码:
inner([X], X).
测试:
?- inner([[[[1,0,2,3],[0,1,2,3]],[[2,1,0,3],[0,1,2,3]]]], L). L = [[[1, 0, 2, 3], [0, 1, 2, 3]], [[2, 1, 0, 3], [0, 1, 2, 3]]].