I have to make a predicate/2 which takes a list of "correct" numbers as validation, and a function which needs to be validated. The numbers in the function (represented as number(X)) has to be the same as the numbers in the validation list, to become "true".
I have no problem making two seperate predicates/1 which give the correct answer when the list is "hard-coded" in the library, but I can for the god of mine not combine these.
I have this so far:
number(X) :- member(X, [1,2,3,4,5]).
This gives the correct result as when i ask for for example and(number(2),number(4)), it says yes, and and(number(2),number(6)) gives no.
But now I have to do predicate/2, which takes the list as the first argument.
Can anyone help/give any hint?
predicate(ValidationList, Function) :- ????
and(number(2),number(4))andand(number(2),number(6))are examples of functions to validate? Or what do you mean (can you show some examples?) with "function which needs to be validated"? Anyway... can you show yourpredicate/1? - max66