Cool. Everything's there but the N.

Learning Haskell is a lot like learning to dance.

Michael


--- On Sun, 7/25/10, Ozgur Akgun <[email protected]> wrote:

From: Ozgur Akgun <[email protected]>
Subject: Re: [Haskell-cafe] Random this! ;-)
To: "Max Rabkin" <[email protected]>
Cc: "michael rice" <[email protected]>, [email protected]
Date: Sunday, July 25, 2010, 3:17 PM

Sorry but I'll just go ahead and eta reduce it :)

rollNDiceIO = flip replicateM $ randomRIO (1,6)

On 25 July 2010 16:44, Max Rabkin <[email protected]> wrote:

On Sun, Jul 25, 2010 at 5:39 PM, michael rice <[email protected]> wrote:


>

> I know, ugly, but at least I got it to work. What's a better way to generate 
> this list?



rollNDiceIO n

   = sequence . replicate n $ randomRIO (1,6)

{{ sequence . replicate n = replicateM n }}

   = replicateM n $ randomRIO (1, 6)



--Max

_______________________________________________

Haskell-Cafe mailing list

[email protected]

http://www.haskell.org/mailman/listinfo/haskell-cafe




-- 
Ozgur Akgun




      
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to