| 3xx3r7 |
here's a problem.
i have a list of facts like this:
fact(x, y).
fact(b, a).
fact(d, c).
fact(z, q).
i need to write a predicate where i input a list of first items and it will spit out a list of corresponding second items, e.g. pred(X, [x, d]). would output X = [y, c].
also, it should be bidirectional, i.e. pred([y, q, a], X). spits out X = [x, z, b].
so far i have is the basic list behaviour:
member(X, [X|Y]).
member(X, [B|Y]) :- member (X,Y). |
|
|