Last active
November 23, 2017 21:22
-
-
Save nullren/e58bb0da3e6c82f8969c91296ea01898 to your computer and use it in GitHub Desktop.
This file contains 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
module Main ( | |
main | |
) | |
where | |
import System.Environment | |
import Data.List | |
import Data.Char | |
wordscape rubric word = contained | |
where | |
word' = sort word | |
rubric' = sort rubric | |
contained = word' `isSubsequenceOf` rubric' | |
main = do | |
rubric <- fmap head getArgs | |
input <- readFile "/usr/share/dict/words" | |
let ls = map (map toLower) $ lines input | |
mapM_ putStrLn $ filter (wordscape rubric) ls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment