1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 07:55:12 +03:00

Don’t unique the lists.

This commit is contained in:
Rob Rix 2016-07-06 10:26:05 -04:00
parent 04eb0126e2
commit 5428115895

View File

@ -48,8 +48,8 @@ rws compare getLabel as bs
longestIncreasingSubsequence :: Ord a => [a] -> [a] longestIncreasingSubsequence :: Ord a => [a] -> [a]
longestIncreasingSubsequence = longestOrderedSubsequenceBy (<) longestIncreasingSubsequence = longestOrderedSubsequenceBy (<)
longestOrderedSubsequenceBy :: Eq a => (a -> a -> Bool) -> [a] -> [a] longestOrderedSubsequenceBy :: (a -> a -> Bool) -> [a] -> [a]
longestOrderedSubsequenceBy isOrd = maximumBy (comparing length) . fmap List.nub . filter (isSortedBy isOrd) . subsequences longestOrderedSubsequenceBy isOrd = maximumBy (comparing length) . filter (isSortedBy isOrd) . subsequences
isSorted :: Ord a => [a] -> Bool isSorted :: Ord a => [a] -> Bool
isSorted = isSortedBy (<=) isSorted = isSortedBy (<=)