PRELUSE: add sortLexSwapped
This commit is contained in:
parent
1dd4dd6f59
commit
79175d7fa0
@ -40,6 +40,14 @@ sortLex =
|
||||
x -> x)
|
||||
|
||||
|
||||
-- |Sort a list of tuples lexicographically, but start with second elem.
|
||||
sortLexSwapped :: (Ord a) => [(a, a)] -> [(a, a)]
|
||||
sortLexSwapped =
|
||||
sortBy (\(x1, y1) (x2, y2) -> case compare y1 y2 of
|
||||
EQ -> compare x1 x2
|
||||
y -> y)
|
||||
|
||||
|
||||
-- |Get the last x elements of a list.
|
||||
getLastX :: Int -> [a] -> [a]
|
||||
getLastX a xs
|
||||
|
Loading…
Reference in New Issue
Block a user