Created
April 26, 2018 16:52
-
-
Save akira02/1ae4c0cce5d3941bce00813fcca4bbd1 to your computer and use it in GitHub Desktop.
Implement nub function in Haskell
This file contains hidden or 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
import qualified Data.Set as S | |
nub = go S.empty | |
where go _ [] = [] | |
go s (x:xs) | S.member x s = go s xs | |
| otherwise = x : go (S.insert x s) xs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment