I want to create a rule in prolog that checks if there's a repeated number in a list.
For example:
- for
[1,2,3,4]
it will returntrue
. - for
[1,2,3,3]
it will returnfalse
because the3
is repeated
I came up with this rule but it doesn't work
Different([]).
Different([H|T]):-
Member(H,T),
Different(T).
Any ideas?