Created
December 23, 2016 22:16
-
-
Save Jamil/83cefe7c323727ecd7f7a6cb14046336 to your computer and use it in GitHub Desktop.
Generate a string given a bigram map, a random number generator, a seed, and an initial token
This file contains hidden or 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
| gen :: [(String, [String])] -> (Int -> Int) -> Int -> String -> [String] | |
| gen lbs rand seed x = case lookup x lbs of | |
| Just [] -> [] | |
| Just followers -> nxt:(gen lbs rand index nxt) | |
| where nxt = followers !! (index `mod` (length followers)) | |
| index = rand seed | |
| Nothing -> [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment