I have a problem with a Prolog exercise. I'm trying to study Computer Science alone at my home, and I'm doing a series of exercises I've taken from the Internet.
The question is the following;
Construct a predicate called
filteringPairsAtoms/3so that given an atom (first argument), and a list of pairs, unify a third parameter with the filtered list of pairs by selecting only the pairs that have the first component as the atom of the first argument.
Example
filteringPairsAtoms(sA,[[basA,absAb],[ab,bbsA],[sA,abbsB],[bsA,sAsB],[sA,bb]],X)
must result in
X = [[sA,abbsB],[sA,bb]]
I'm trying to solve it but I don't have anyone to ask, because I'm learning alone, and don't have a professor to write to or something.
Any help is welcome.
Thanks!!!