Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

please save my life!!!!!

Status
Not open for further replies.

YZzzz

Programmer
Nov 17, 2002
1
GB
Hi,

Given the fact p(a,X,Z) and List= [e,f], how can i
create its expansion which is the set of
[p(a,e,e),p(a,e,f),p(a,f,e),p(a,f,f)]
Thanks
 
Hi,

Even though this is not an elligant solution, but it works.
Here u go.

expand(p(A,B,C),List,Result):-setof([p(A,B,C)], exp(p(A,B,C), List),Result).
exp(p(A,B,C),List):-member(B,List),member(C,List).

?- List=[e,f],expand(p(a,X,Z),List,Result).

List = [e, f]
X = _G167
Z = _G168
Result = [[p(a, e, e)], [p(a, e, f)], [p(a, f, e)], [p(a, f, f)]]

Yes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top