Here it is in Prolog.
allSame([]). allSame([X]). allSame([X,X|Xs]) :- allSame([X|Xs]).