i'll try a very non-technical explanation that has worked for me so
far.  (is it correct?  does it make sense?)

IO and ST are quite similar.  the difference is that whereas IO gives
you a concept of time in the world surrounding your code, ST lets you
create a little bubble inside your code in which you can maintain
state, while the bubble as a whole acts all pure and lazy.  for
example, if you want to implement an algorithm that writes to and
reads from a matrix, you use ST: you want to control the order in
which you read from and write to it, but not the order in which access
events to that data structure mixes with user interaction events.

-matthias



On Mon, Oct 12, 2009 at 12:25:43AM -0700, Michael Mossey wrote:
> To: Haskell Cafe <Haskell-Cafe@haskell.org>
> Cc: 
> From: Michael Mossey <m...@alumni.caltech.edu>
> Date: Mon, 12 Oct 2009 00:25:43 -0700
> Subject: [Haskell-cafe] statistics package and randomness
> 
> I'm trying to learn how to use randomness in Haskell and it seems very  
> non-straightforward and complex. I could do a lot of things using 'split' 
> from System.Random, but apparently it's broken. There is the statistics  
> package here:
>
> http://hackage.haskell.org/package/statistics
>
> Is this a better solution?
>
> It uses the ST monad in the RandomVariate module. Can someone point me to 
> a tutorial explaining ST, and/or a tutorial in the RandomVariate module?
>
> Pseudorandomness seems like one case where it would just be a hell of a 
> lot simpler to have a global generator--never split the state. Is the ST 
> monad some way to accomplish this?
>
> Thanks,
> Mike
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
> ** ACCEPT: CRM114 PASS osb unique microgroom Matcher ** CLASSIFY 
> succeeds; success probability: 1.0000  pR: 5.5394
> Best match to file #0 (nonspam.css) prob: 1.0000  pR: 5.5394  Total 
> features in input file: 2960
> #0 (nonspam.css): features: 758386, hits: 2888631, prob: 1.00e+00, pR:   
> 5.54 #1 (spam.css): features: 1683715, hits: 3150692, prob: 2.89e-06, pR: 
>  -5.54 
>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to