Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Data.Foldable
- maxSquare :: (Ord a, Num a) => [(a -> a)] -> (a -> a)
- maxSquare funcs = helper
- where helper x = snd $ maximumBy getMax (map makeTuples funcs)
- where makeTuples f = (f x * f x, f x)
- getMax a b = compare (fst a) (fst b)
- -- maxSquare :: (Ord a, Num a) => [(a -> a)] -> (a -> a)
- -- maxSquare funcs = helper
- -- where helper x = sqrt $ maximum (map getSquared funcs)
- -- where getSquared f = f x * f x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement