[Haskell-cafe] Random this! ;-)

michael rice nowgate at yahoo.com
Sun Jul 25 16:04:00 EDT 2010

Cool. Everything's there but the N.

Learning Haskell is a lot like learning to dance.


--- On Sun, 7/25/10, Ozgur Akgun <ozgurakgun at gmail.com> wrote:

From: Ozgur Akgun <ozgurakgun at gmail.com>
Subject: Re: [Haskell-cafe] Random this! ;-)
To: "Max Rabkin" <max.rabkin at gmail.com>
Cc: "michael rice" <nowgate at yahoo.com>, haskell-cafe at haskell.org
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 <max.rabkin at gmail.com> wrote:

On Sun, Jul 25, 2010 at 5:39 PM, michael rice <nowgate at yahoo.com> 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)



Haskell-Cafe mailing list

Haskell-Cafe at haskell.org


Ozgur Akgun

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100725/daecdfb9/attachment.html

More information about the Haskell-Cafe mailing list