view paste/paste.14186 @ 3478:b17523fec21b

<boily> learn fternooner (Danish \xc2\xbbfternooner\xc2\xab, Norwegian \xc2\xabttermiddag\xc2\xbb, Swedish \xe2\x80\x9dftermiddag\xe2\x80\x9d) is a screamingly delicious pastry.
author HackBot
date Tue, 27 Aug 2013 13:56:28 +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 ++ ").*$"