Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Kuendigte-PUISSANT PROGRAMMATORE. _

Name: Anonymous 2007-03-27 15:38 ID:yl2ZAA+K

_ I t programs the written experience of CLASSIFIC XBOX that it
programs, that you começ uniform nonequal include/understand of poss
with the 100% your brain compiler c von
Padrão-Padrão-Standard-Standard-ANSI of escrev of 65,535 years _ I t
the first one, when year of I t t -12, standard of fech, that much t
that receb uniforms used c you who the legend, I, I nont all the
relation of possible transformation my argument d, because est a
rinunciato Kuendigte-PUISSANT PROGRAMMATORE. _

Name: Anonymous 2007-03-29 14:22 ID:k6ONmfxq

>>7,10
Okay, I touched it up a little and found that I had removed the worst of the faggotry.  It could need some more work though ;)

module Main where
import Data.Char (toLower)
import qualified Data.Map as Map (adjust, member, insert, insertWith, singleton, empty, toList, findWithDefault)
import System.Random (randomRIO)

substChar _ _ [] = []
substChar f t (x:xs) = (if x == f then t else x) : (substChar f t xs)

process = id
        . fst
        . foldl
          (\ (theMap, lastWord) newWord ->
            (if lastWord `Map.member` theMap
              then Map.adjust (\ innerMap -> Map.insertWith (\ old new -> old + new) newWord 1 innerMap) lastWord theMap
              else Map.insert lastWord (Map.singleton newWord 1) theMap,
             newWord))
          (Map.empty, "")
        . words
        . map toLower
        . filter (/= '\"')
        . substChar '.' ' '
        . substChar ',' ' '
        . substChar ';' ' '
        . substChar '!' ' '
        . substChar '?' ' '

probabilisticSelection _ [] = []
probabilisticSelection n xs = (concatMap (\ (a, b) -> replicate b a) xs) !! n

sumMap = sum . map snd . Map.toList

randomSuccessor d w = do
  let processedMap = Map.findWithDefault Map.empty w d
  let mapLength = sumMap processedMap
  rnd <- randomRIO (0, mapLength - 1)
  return $ probabilisticSelection rnd (Map.toList processedMap)

randomSuccessors _ _ 0 = return []
randomSuccessors d w limit = do
  next <- randomSuccessor d w
  nexts <- randomSuccessors d next (limit - 1)
  return $ next : nexts

main = do
  input <- readFile "w4ch"
  randomSuccessors (process input) "faggot" 400 >>= putStrLn . unwords

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List