Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 6th, 2020 128 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. alienGroupList = [[5],[2,6],[1,10,9]]
  2.  
  3. videoList = [(1,4),(3,10),(2,6),(5,8)]
  4.  
  5. calcAlienGroups :: (Num a, Ord a) => [[a]] -> [(a, a)] -> [Integer]
  6. calcAlienGroups xs ys = [ _calcOneAlienGroup x ys | x <- xs ]
  7.  
  8. _calcOneAlienGroup :: (Num a, Ord a) => [a] -> [(a, a)] -> Integer
  9. _calcOneAlienGroup xs ys = _sumBool [ _calcOneVideo xs y | y <- ys]
  10.  
  11. _calcOneVideo :: (Num a, Ord a) => [a] -> (a, a) -> Bool
  12. _calcOneVideo xs y = or [ _inRange x y | x <- xs ]
  13.  
  14. _sumBool :: [Bool] -> Integer
  15. _sumBool [] = 0
  16. _sumBool (x:xs)
  17.     | x == True  = _sumBool xs + 1
  18.     | x == False = _sumBool xs
  19.  
  20. _inRange :: (Num a, Ord a) => a -> (a, a) -> Bool
  21. _inRange x (s, e)  
  22.     | x < s     = False
  23.     | x > e     = False
  24.     | otherwise = True
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top