-
-
Save dminuoso/3e7c5c815ce0e09a02e809d99b39e963 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
isUnique xs = go Set.empty xs | |
where | |
go buf (x:xs) = x `Set.notMember` buf -- if we have seen it before, we break off | |
&& go (Set.insert x buf) xs -- otherwise, put the element to the set, move on to the rest | |
go _ [] = True -- list is unique if we reached the end of it |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment