changeset 1339:e1d6b455ff43

<GreyKnight> mv hiJM gktemp/welcome.hs
author HackBot
date Thu, 10 Jan 2013 12:59:09 +0000
parents 38bc85347cbc
children 8a5ecf7cfab6
files gktemp/welcome.hs hiJM
diffstat 2 files changed, 42 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gktemp/welcome.hs	Thu Jan 10 12:59:09 2013 +0000
@@ -0,0 +1,42 @@
+import Data.List
+import Data.Char
+
+standardURL = "http://esolangs.org/wiki/Main_Page"
+standardMessage = "Welcome to the international hub for esoteric programming language design and deployment! For more information, check out our wiki: @. (For the other kind of esoterica, try #esoteric on irc.dal.net.)"
+
+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
+
+
+
+reversibles = "<([{}])>"
+
+-- there is probably a better way to do this with guards or somesuch
+reverseChar :: Char -> Maybe Int -> Char
+reverseChar c Nothing = c
+reverseChar c (Just a) = reversibles !! (length reversibles - 1 - a)
+
+tidyReverse :: String -> String
+tidyReverse [] = []
+tidyReverse (c:cs) = (tidyReverse cs) ++ [reverseChar c (elemIndex c reversibles)]
+
+
+makeWelcome :: (String -> String) -> String -> String  -- filter nick -> result
+makeWelcome f nick = applyTemplate nick (f standardMessage)
+
+
+welcome = makeWelcome id
+emoclew = makeWelcome tidyReverse
+wELCOME = makeWelcome (map toUpper)
+eMOCLEW = makeWelcome ((map toUpper) . tidyReverse)
+
--- a/hiJM	Thu Jan 10 12:58:58 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-import Data.List
-import Data.Char
-
-standardURL = "http://esolangs.org/wiki/Main_Page"
-standardMessage = "Welcome to the international hub for esoteric programming language design and deployment! For more information, check out our wiki: @. (For the other kind of esoterica, try #esoteric on irc.dal.net.)"
-
-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
-
-
-
-reversibles = "<([{}])>"
-
--- there is probably a better way to do this with guards or somesuch
-reverseChar :: Char -> Maybe Int -> Char
-reverseChar c Nothing = c
-reverseChar c (Just a) = reversibles !! (length reversibles - 1 - a)
-
-tidyReverse :: String -> String
-tidyReverse [] = []
-tidyReverse (c:cs) = (tidyReverse cs) ++ [reverseChar c (elemIndex c reversibles)]
-
-
-makeWelcome :: (String -> String) -> String -> String  -- filter nick -> result
-makeWelcome f nick = applyTemplate nick (f standardMessage)
-
-
-welcome = makeWelcome id
-emoclew = makeWelcome tidyReverse
-wELCOME = makeWelcome (map toUpper)
-eMOCLEW = makeWelcome ((map toUpper) . tidyReverse)
-