Question

Comment développer une requête dans une liste?

f(a,b).
f(a,c).
d(a.d).

expand(f(a,X), Out)  -----> Out=[b,c,d]
Était-ce utile?

La solution

Utilisez bagof / 3 ou setof / 3. Exemple:

? - bagof (X, (X = 1; X = 2), L).

L = [1,2]

oui

Dans votre cas, ce serait

? - bagof (X, f (a, X), Out).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top