Skip to content

Instantly share code, notes, and snippets.

@shasts
Created April 14, 2014 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shasts/10683106 to your computer and use it in GitHub Desktop.
Save shasts/10683106 to your computer and use it in GitHub Desktop.
module Anagram (anagramsFor) where
import Data.List
import Data.Char
anagramsFor :: String -> [String] -> [String]
anagramsFor seed anagrams = filter (notAnagram) anagrams
where
notAnagram word
|seed == word = False
|caseIgnoredSeed == sort (map toLower word) = True
|otherwise = False
where
caseIgnoredSeed = sort $ map toLower seed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment