Created
March 2, 2015 15:44
-
-
Save MiyamonY/4a84ecedf7d8d0b47d25 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Monoid | |
-- class Monoid m where | |
-- mempty :: m | |
-- mappend :: m -> m -> m | |
-- mconcat = foldr mappend mempty | |
-- instance Monoid [a] where | |
-- mepmty = [] | |
-- mappend = (++) | |
lengthCompare :: String -> String -> Ordering | |
-- lengthCompare x y = let a = length x `compare` length y | |
-- b = x `compare` y | |
-- in if a == EQ then b else a | |
lengthCompare x y = | |
(length x `compare` length y) `mappend` | |
(vowels x `compare` vowels) `mappend` | |
(x `compare` y) | |
where vowels x = length . filter (`elem` "aiueo") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment