basically what I’ve managed to do is create a list of tuples in the form A = [[1,2,3],[1,2,12],[1,2,5]] using a fact makelist(A).
What I want to do now is to use that to create another list where it only contains the tuples that are true for a given fact.
for example, I have a test that returns true if a number is prime prime(N) (which takes a number and returns true if it is prime) i want to use that to keep only the third elements in A that are prime. So A = [[1,2,3],[1,2,5]]
I’ve tried to use predsort but that seems to not work on only one element. I thought that it could be done using exclude but I can’t seem to get it to work.
Thanks for any help you can give me.
With lambda.pl, you could write:
Without it you could write:
BTW, you mentionned using
exclude/3: those solutions are exactly alike ones using it, only they use its dual predicate,include/3.