Skip to content

Instantly share code, notes, and snippets.

@nietaki
Created March 4, 2012 19:59
Show Gist options
  • Save nietaki/1974568 to your computer and use it in GitHub Desktop.
Save nietaki/1974568 to your computer and use it in GitHub Desktop.
pairLEQ :: (Ord i) => (i, e) -> (i, e) -> Bool
pairGT :: (Ord i) => (i, e) -> (i, e) -> Bool
pairLEQ (i1, e1) (i2, e2) = i1 <= i2
--pairGT a b = not (pairLEQ a b)
pairGT a = not . (pairLEQ a)
-- z wykładu 2
pairQS :: (Ord i) => [(i, e)] -> [(i, e)]
pairQS [] = []
pairQS (x:xs) = (pairQS (filter (flip pairLEQ x) xs))
++ [x]
++ (pairQS (filter (flip pairGT x) xs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment