Skip to content

Instantly share code, notes, and snippets.

@nullren
Last active November 23, 2017 21:22
Show Gist options
  • Select an option

  • Save nullren/e58bb0da3e6c82f8969c91296ea01898 to your computer and use it in GitHub Desktop.

Select an option

Save nullren/e58bb0da3e6c82f8969c91296ea01898 to your computer and use it in GitHub Desktop.

Revisions

  1. Renning Bruns revised this gist Nov 23, 2017. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions wordscapes.hs
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    module Wordscapes (
    wordscape
    module Main (
    main
    )
    where

    @@ -17,4 +17,4 @@ 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
    mapM_ putStrLn $ filter (wordscape rubric) ls
  2. Renning Bruns revised this gist Nov 23, 2017. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions wordscapes.hs
    Original file line number Diff line number Diff line change
    @@ -14,8 +14,7 @@ wordscape rubric word = contained
    contained = word' `isSubsequenceOf` rubric'

    main = do
    args <- getArgs
    let rubric = head args
    input <- getContents
    rubric <- fmap head getArgs
    input <- readFile "/usr/share/dict/words"
    let ls = map (map toLower) $ lines input
    mapM_ putStrLn $ filter (wordscape rubric) ls
  3. Renning Bruns created this gist Nov 23, 2017.
    21 changes: 21 additions & 0 deletions wordscapes.hs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    module Wordscapes (
    wordscape
    )
    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
    args <- getArgs
    let rubric = head args
    input <- getContents
    let ls = map (map toLower) $ lines input
    mapM_ putStrLn $ filter (wordscape rubric) ls