I wanna implement the DPLL algorithm. Therefore i have to remove all occurrencies of a variable in a list of other variables, e.g. deleting neg(X) out of [neg(X), pos(X), neg(Y), pos(Y)] should return [pos(X), neg(Y), pos(Y)].
I've tried some built-in predicates like exclude/3 or delete/3 but all left me with asuming X = Y and a result [pos(X), pos(Y)], with all neg(_) removed, but I only want neg(X) removed and not neg(Y). Is this somehow possible?
How to remove a variable out of a list of variables in prolog?
580 Views Asked by Kevin Schwarz At
1
From the Logtalk library
listobject:Sample call:
The key is to use the standard
==/2term equality predicate instead of the standard=/2unification predicate.