view paste/paste.14186 @ 11255:ad0977bc1f45

<oerjan> addquote <Taneb> English is a lie, words lack intrinsic meaning <int-e> fortunately people don\'t operate for long in a vacuum so there\'ll always be context
author HackBot
date Thu, 07 Dec 2017 10:21:07 +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 ++ ").*$"