# HG changeset patch # User HackBot # Date 1357824570 0 # Node ID f05a75aa8c33bd1a0ee49658137273aa8041718a # Parent 5ce6274a65e9ffb41f5b092261dcafc6e7b7ad37 mv jXOV gktemp/target diff -r 5ce6274a65e9 -r f05a75aa8c33 gktemp/target --- a/gktemp/target Thu Jan 10 13:29:06 2013 +0000 +++ b/gktemp/target Thu Jan 10 13:29:30 2013 +0000 @@ -1,5 +1,6 @@ import Data.List import Data.Char +import System.Environment standardURL = "http://esolangs.org/wiki/Main_Page" @@ -19,6 +20,7 @@ main = do + args <- getArgs template <- getLine - putStrLn (applyTemplate nick template) + putStrLn (applyTemplate (args !! 0) template) diff -r 5ce6274a65e9 -r f05a75aa8c33 jXOV --- a/jXOV Thu Jan 10 13:29:06 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -import Data.List -import Data.Char -import System.Environment - -standardURL = "http://esolangs.org/wiki/Main_Page" - - -replace :: (Eq a) => [a] -> [a] -> [a] -> [a] -replace _ _ [] = [] -replace old new (y:ys) = - case stripPrefix old (y:ys) of - Nothing -> y : replace old new ys - Just ys' -> new ++ replace old new ys' - -applyGenTemplate :: String -> String -> String -> String -- nick url template -> result -applyGenTemplate nick url template = nick ++ ": " ++ replace "^" nick (replace "@" url template) - -applyTemplate :: String -> String -> String -- nick template -> result -applyTemplate nick template = applyGenTemplate nick standardURL template - - -main = do - args <- getArgs - template <- getLine - putStrLn (applyTemplate (args !! 0) template) -