Guest User

Untitled

a guest
Mar 18th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. Prelude> myMaximumBy (_ _ -> GT) [1..10]
  2. 1
  3. Prelude> myMaximumBy (_ _ -> LT) [1..10]
  4. 10
  5.  
  6. myMaximumBy :: (a -> a -> Ordering) -> [a] -> a
  7. myMaximumBy f (x:xs) = foldl doF x xs
  8. where
  9. doF a b
  10. | f a b == GT = a
  11. | otherwise = b
Add Comment
Please, Sign In to add comment