changeset 1347:f05a75aa8c33

<GreyKnight> mv jXOV gktemp/target
author HackBot
date Thu, 10 Jan 2013 13:29:30 +0000
parents 5ce6274a65e9
children ec6018972dc0
files gktemp/target jXOV
diffstat 2 files changed, 3 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- 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)
 
--- 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)
-