view paste/paste.14186 @ 1893:2bbb248b7e71

<oerjan> addquote <Sgeo> If that sexy_goats had some sort of namespace, so other things could add their own sexy_goats method to Object or whatever to do something different, I would have no complaint
author HackBot
date Wed, 30 Jan 2013 00:22:59 +0000
parents e037173e0012
children
line wrap: on
line source

import System.Environment
import System.Process
import System.Exit
import Control.Monad
import Control.Applicative
import Data.List

main = do
    r <- buildRegex . permuteArgs <$> getArgs
    (_, _, _, h) <- createProcess (proc "/hackenv/bin/log" [r])
    exitWith <$> waitForProcess h
   where
     permuteArgs = permutations . join . map words
     buildRegex = oBrackets . intercalate ".*" . map (iBrackets . intercalate "|")
     iBrackets s = "(?:" ++ s ++ ")"
     oBrackets s = "^.*(?:" ++ s ++ ").*$"