Name: Anonymous 2009-07-27 14:50
I wrote some actual programmes when you were down. Please don't leave me again.
openTag s = "[" ++ s ++ "]"
closeTag s = openTag ('/':s)
surround s t = openTag s ++ t ++ closeTag s
-- Too lazy to use TH
[sup, sub, code, b, i, spoiler, o, u, s] =
map surround ["sup", "sub", "code", "b", "i", "spoiler", "o", "u", "s"]
tacnoc = map (:[])
crack f = concat . f . tacnoc
rev f = reverse . f . reverse
dowords f = unwords . f . words
(->!) = zipWith ($)
clamour = b . i . o . u
loveyourpost = unwords $ [b, i, o, u] ->!
lines "I LOVE YOU!\nI LOVE YOUR POST!\nI READ IT FIVE TIMES!\nKEEP POSTING!"
-- Check your length!
zipLines top bot a b = concat fin -- French
where fin = zipWith (++) topped bottomed
topped = map top (tacnoc a)
bottomed = map bot (tacnoc b)
(a', b') = fixl (a, b)
fixl ([], xs) = (cycle " ", xs)
fixl (xs, []) = (xs, cycle " ")
fixl (x:xs, y:ys) = let (xs', ys') = fixl (xs, ys) in (x:xs', y:ys')
dotagr t = t . foldr1 (\l r -> l ++ t r)
dotagl t = t . foldl1 (\l r -> t l ++ r)
deal tag [] = []
deal tag ws
| length ws < 3 = tag ws
| otherwise = tag ws'
where wa = head ws
wz = last ws
mid = take (length ws - 2) $ tail ws
ws' = (wa :) $ deal tag mid ++ [wz]
deal2 t s = dotagr t sl ++ dotagl t sr
where ln = length s `div` 2
sl = take ln s
sr = drop ln s
bbcode = b $ sup "B" ++ sub "B" ++ "Code"
say = putStrLn