-
You'll need Data.Char.toLower :: Char -> Char, Prelude.map :: (a -> b) -> [a] -> [b], Data.List.sortBy :: (Ord a) => (a -> a -> Ordering) -> [a] -> [a], and Data.Ord.comparing :: (Ord a) => (b -> a) -> b -> b -> Ordering:
Code:
import Data.List (sortBy)
import Data.Char (toLower)
import Data.Ord (comparing)
orderWords = unwords . sortBy (comparing $ map toLower) . words
-
Quote:
Originally Posted by
Twey
You'll need
Data.Char.toLower :: Char -> Char,
Prelude.map :: (a -> b) -> [a] -> [b],
Data.List.sortBy :: (Ord a) => (a -> a -> Ordering) -> [a] -> [a], and
Data.Ord.comparing :: (Ord a) => (b -> a) -> b -> b -> Ordering:
Code:
import Data.List (sortBy)
import Data.Char (toLower)
import Data.Ord (comparing)
orderWords = unwords . sortBy (comparing $ map toLower) . words
twey is there anyway i can email you, just wanted to ask you summit about my code, but dont want to post it on here cause its part of my project and might get plagerised. tried your email but email keeps bouncing back and cant pm eitha. or any one else who can spare 5 mins! thanks
-
After you've replied to this message, you should be able to PM me (requires five posts first, to keep the spammers out).
I must say, I thought my email account for this forum was still active. If not, no matter, PM me. You can also reach my main email account by removing the '-dd' from the email address I use here.
-
-
Haskell HELP REQUIRE
ok ------------------------------------