I am required to write my own version of all_different in SWI-Prolog. I've written a predicate that returns the same true/false on the inputs I'm giving as all_different does, but I'm having trouble finding online a way to actually apply this predicate as a constraint.. Here is my version of all_different.
distinct([]).
distinct([X|Xs]) :-
different(X,Xs),
distinct(Xs).
different(_,[]).
different(X,[Y|Ys]) :-
(nonvar(X), nonvar(Y) -> X \= Y
;
true
),
different(X,Ys).
I need it to apply to a list of integers and _. Yes, this is the sudoku program project. Sorry if this is a dumb question, but I am still very new to Prolog, and I find it difficult to find sufficient documentation online. Please help!