Skip to content

Instantly share code, notes, and snippets.



Last active Oct 6, 2015
What would you like to do?
Militia Name Generator
-- Clojure -> Haskell port of:
import System.Random (getStdRandom, randomR)
pick :: [a] -> IO a
pick xs = do
n <- getStdRandom $ randomR (0, length xs - 1)
return $ xs !! n
adjs = ["people's", "brave", "invincible", "unstoppable", "righteous", "just", "honorable", "terrifying", "peaceful"]
whos = ["striking hand", "liberators", "children", "sons and daughters", "defenders", "friends", "guardians"]
orgs = ["movement", "army", "militia", "party", "kinship", "revolution", "front"]
pres = ["tel", "jourat", "borj", "wadi", "ras", "jal", "jabal", "ain"]
plcs = ["zaatar", "heem", "kfour", "ghodras", "tirmos"]
bigs = ["people", "zaim", "sultan", "world", "earth", "oppressed", "forgotten", "poor"]
genMilitia :: IO String
genMilitia = do
org <- pick orgs
adj <- pick adjs
who <- pick whos
big <- pick bigs
pre <- pick pres
plc <- pick plcs
who' <- pick [who, org, adj ++ " " ++ org]
plc' <- pick [big, plc, pre ++ " " ++ plc]
return $ unwords ["the", who', "of the", plc']

This comment has been minimized.

Copy link

@nasser nasser commented Oct 6, 2015

love it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment