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.
如何将查询扩展为列表?
f(a,b). f(a,c). d(a.d). expand(f(a,X), Out) -----> Out=[b,c,d]
使用 bagof/3 或 setof/3。例如:
?- bagof(X, (X = 1; X = 2), L)。
L = [1,2]
是的
在你的情况下,那将是
?- bagof(X, f(a,X), Out)。