zcashero
03-16-2007, 09:18 PM
I am using the subset predicate in a fairly straight-forward way, but I am not getting the result that I expect.
Using SWI-Prolog, when I enter the following query, it returns False:
subset([at_truck(_G2352, _G2417), in_truck(o1, _G2352)], [at_truck(truck1, p1), at_truck(truck2, p2), in_truck(o1, truck2)]).
If I switch the two "at_truck" elements in the second list (so that at_truck(truck2, p2) comes first), then it will return true.
So I guess it just matches the first instance it finds to assign the variables and does not check any other possibilities.
Is there any way to make Prolog to check all possible variable assignments, since in reality I won't have control over the order of the statements.
Thanks,
zcashero
Using SWI-Prolog, when I enter the following query, it returns False:
subset([at_truck(_G2352, _G2417), in_truck(o1, _G2352)], [at_truck(truck1, p1), at_truck(truck2, p2), in_truck(o1, truck2)]).
If I switch the two "at_truck" elements in the second list (so that at_truck(truck2, p2) comes first), then it will return true.
So I guess it just matches the first instance it finds to assign the variables and does not check any other possibilities.
Is there any way to make Prolog to check all possible variable assignments, since in reality I won't have control over the order of the statements.
Thanks,
zcashero