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.
我想将两个列表说 [1,2] 和 [3,4] 附加到单个列表中,
[[1,2],[3,4]]. 这怎么能在序言中实现。我总是把它当作[1,2,3,4].
[[1,2],[3,4]]
[1,2,3,4]
谢谢
glue(A, B, [A, B]).
这个不用多说了吧!
用法是
?- glue([1, 2], [3, 4], R). R = [[1, 2], [3, 4]].
但实际上,您可以对其进行硬编码,而不是将其包装在谓词中。