As the title says I want to write a program that does this.
an example would be:
?- count(member(X,[1,2,3]), N).
N = 3
Yes
But not only for the build in member, but also for some operators like:
?- count(17 =:= 12 + 5, N).
N = 1
Yes
Can someone help me get started?
Try this:
?- findall(., Goal, Ls), length(Ls, L).
Example:
?- findall(., member(X,[1,2,3]), Ls), length(Ls, L). L = 3, ... .