annotate paste/paste.14186 @ 11293:a7899ef2d7b6

<wob_jonas> learn Aristotle said that every illness can be cured by balancing the four vitreous humors, and everyone believed him for two thousand years, even though people still died of illnesses. It wasn\'t until the 20th century that Szent-Gy\xc3\xb6rgyi Albert realized that Aristotle didn\'t find fifth kind of vitreous humor, vitamin C, because the Greek alphabet
author HackBot
date Mon, 01 Jan 2018 17:57:43 +0000
parents e037173e0012
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e037173e0012 Initial import.
HackBot
parents:
diff changeset
1 import System.Environment
e037173e0012 Initial import.
HackBot
parents:
diff changeset
2 import System.Process
e037173e0012 Initial import.
HackBot
parents:
diff changeset
3 import System.Exit
e037173e0012 Initial import.
HackBot
parents:
diff changeset
4 import Control.Monad
e037173e0012 Initial import.
HackBot
parents:
diff changeset
5 import Control.Applicative
e037173e0012 Initial import.
HackBot
parents:
diff changeset
6 import Data.List
e037173e0012 Initial import.
HackBot
parents:
diff changeset
7
e037173e0012 Initial import.
HackBot
parents:
diff changeset
8 main = do
e037173e0012 Initial import.
HackBot
parents:
diff changeset
9 r <- buildRegex . permuteArgs <$> getArgs
e037173e0012 Initial import.
HackBot
parents:
diff changeset
10 (_, _, _, h) <- createProcess (proc "/hackenv/bin/log" [r])
e037173e0012 Initial import.
HackBot
parents:
diff changeset
11 exitWith <$> waitForProcess h
e037173e0012 Initial import.
HackBot
parents:
diff changeset
12 where
e037173e0012 Initial import.
HackBot
parents:
diff changeset
13 permuteArgs = permutations . join . map words
e037173e0012 Initial import.
HackBot
parents:
diff changeset
14 buildRegex = oBrackets . intercalate ".*" . map (iBrackets . intercalate "|")
e037173e0012 Initial import.
HackBot
parents:
diff changeset
15 iBrackets s = "(?:" ++ s ++ ")"
e037173e0012 Initial import.
HackBot
parents:
diff changeset
16 oBrackets s = "^.*(?:" ++ s ++ ").*$"