view paste/paste.14186 @ 9370:d8453ee06dd9

<Zarutian> le/rn cemental/ The feeling of being cemented in place and it is making you mental. Can happen in ackward infrequent family gatherings such as Easter-Bum-Hunting where one cannot leave without breaking an reluctantly ontaken social responsibility.
author HackBot
date Thu, 20 Oct 2016 01:24:23 +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 ++ ").*$"