Skip to content

Instantly share code, notes, and snippets.

@myrkvi
Created June 26, 2013 11:41
Show Gist options
  • Save myrkvi/5866777 to your computer and use it in GitHub Desktop.
Save myrkvi/5866777 to your computer and use it in GitHub Desktop.
Haskell test
module Main where
import Prelude
import System.Random
adj = ["funny", "soft", "neat", "tasteful", "aerodynamic", "smooth", "hard", "circle-shaped", "tiny", "long", "hairy", "adorable", "bloody", "clean", "dark", "elegant", "fancy", "filthy", "gorgeus", "light", "motionless", "plain", "shiny", "sparkling", "ugly", "unusual", "breakable", "busy", "concerned", "dead", "different", "fragile", "helpless", "anxious", "bad", "awful", "clumsy", "envious", "foolish", "grumpy", "jealous", "nervous", "scary", "terrible", "thoughtless", "wicked"]
noun = ["cat", "dog", "chair", "couch", "door", "pet", "human", "car", "refridgerator", "television", "napkin", "book", "cellphone", "man", "mountain", "house", "photograph", "movie", "train", "country", "clock", "pen", "milk", "water", "waiter", "sock", "monkey"]
creative = [a ++ " " ++ n | a <- adj, n <- noun]
cl = (length creative) - 1
main = do
gen <- newStdGen
let (rand, _) = randomR (0, cl) gen
let phrase = creative!!rand ++ "."
let h = head phrase
let aan = if (h `elem` "aeiou") then "an" else "a"
putStrLn ("Your mother was " ++ aan ++ " " ++ phrase)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment