[Haskell-cafe] How would you hack it?
lemming at henning-thielemann.de
Wed Jun 4 16:55:19 EDT 2008
On Wed, 4 Jun 2008, Andrew Coppin wrote:
> How would you do this?
> The approach I came up with is to slurp up the words like so:
> raw <- readFile "words.txt"
> let ws = words raw
> let n = length ws
> let wa = listArray (1,n) ws
> (I actually used lazy ByteStrings of characters.) So now I have an array
> of packed ByteStrings, and I can pick array indexes at random and use
> "unwords" to build my gibberish "sentences".
Sounds like a generator for scientific articles. :-)
can be of help for you. It's also free of randomIO.
> In my current implementation, all of this is in the IO monad (so I can
> pick things randomly).
You know of
More information about the Haskell-Cafe