Created
June 26, 2013 11:41
-
-
Save myrkvi/5866777 to your computer and use it in GitHub Desktop.
Haskell test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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