view paste/paste.14186 @ 6894:1041408d241c

<oerjan> le/rn soviet union/In ancient history, the Soviet Union used to be the THEM. They believed in absurd principles like "Better Red than Dead". Then Ronald Reagan invented Star Wars to destroy it, after which there seemed to be no the THEM for a while.
author HackBot
date Tue, 16 Feb 2016 21:39:22 +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 ++ ").*$"