Re: Stream of random comments continues

1998-12-04 Thread Mikael Rittri
Dave Tweed wrote: > On Fri, 4 Dec 1998, Keith Wansbrough wrote: > > > Surely it would be better to split the one stream into several infinite ones: > > - - - > > Closer inspection reveals this is not a necessarily a the best idea > (particularly if you're going to repeat the trick several times

Re: Stream of random comments continues

1998-12-04 Thread Lennart Augustsson
> There was a paper > published in the JFP about a better way of splitting streams which I think > appeared sometime between January 1996--October 1996. Are you perhaps referring to the paper by me, Mikael Rittri, and Dan Synek called "On generating unique names" (Jan 94). It has a low level tri

Re: Stream of random comments continues

1998-12-04 Thread D. Tweed
On Fri, 4 Dec 1998, Lennart Augustsson wrote: > > > There was a paper > > published in the JFP about a better way of splitting streams which I think > > appeared sometime between January 1996--October 1996. > Are you perhaps referring to the paper by me, Mikael Rittri, and Dan Synek > called "On

Re: Stream of random comments continues

1998-12-04 Thread Sven Panne
Keith Wansbrough wrote: > Surely it would be better to split the one stream into several infinite ones: > > splitStream :: [a] -> ([a],[a]) > > splitStream xs = unzip (spl xs) > where spl (x:y:xs) = (x,y):(spl xs) > > Then you don't have to know how many you are going to use from each s

Re: Stream of random comments continues

1998-12-04 Thread D. Tweed
On Fri, 4 Dec 1998, Keith Wansbrough wrote: > Surely it would be better to split the one stream into several infinite ones: > > splitStream :: [a] -> ([a],[a]) > > splitStream xs = unzip (spl xs) > where spl (x:y:xs) = (x,y):(spl xs) > > Then you don't have to know how many you are goi

Re: Stream of random comments continues

1998-12-04 Thread Ralf Hinze
| The discussion of random numbers in Haskell should perhaps | move elsewhere as it is quite restricted, but it shows one | problem with the functional approach to *practical* programming: | in *my opinion* our fascination by the Monadic Approach to | Universe and Everything, and the possibility

Re: Stream of random comments continues

1998-12-04 Thread Keith Wansbrough
> Lennart advocates the use of streams : > > > let mis = take n (random ss1) > > is = take n (toInt (random ss2)) > > ds = take n (toDouble (random ss3)) > > in ... > > and I agree entirely with him, although the coding details might > be different. Streams are nice and safe.

Stream of random comments continues

1998-12-04 Thread Jerzy Karczmarczuk
The discussion of random numbers in Haskell should perhaps move elsewhere as it is quite restricted, but it shows one problem with the functional approach to *practical* programming: in *my opinion* our fascination by the Monadic Approach to Universe and Everything, and the possibility to program

Re: Random comments

1998-12-03 Thread Ralf Hinze
| First: I had forgotten that what the Random module actually | gives you is [Integer], not [Int], but the same reasoning | applies. What's the range for the Integers? I guess Int is better suited. | Well, you naturally need functions that convert a list of | [Integer] to what you need. I'm not

Re: Random comments

1998-12-03 Thread Lennart Augustsson
> I guess you would end up with nearly the same code (unless I overlook > an obvious alternative in which case I would love to see the simple and > straightforward solution ;-). Let's be concrete: say you need n > Integers within range (l, r), m Ints and p Doubles. Using a monad-based > approach

Re: Random comments

1998-12-03 Thread Ralf Hinze
| > The stream-based approach has its problems if one requires random | > values of different types. If this is vital one automatically starts to | > use functions of type Seed -> (value, Seed). | I don't understand at all. Why would random values of different types | require that signature? Why

Re: Random comments

1998-12-03 Thread Lennart Augustsson
> The stream-based approach has its problems if one requires random > values of different types. If this is vital one automatically starts to > use functions of type Seed -> (value, Seed). I don't understand at all. Why would random values of different types require that signature? Why can you

Re: Random comments

1998-12-03 Thread Ralf Hinze
| Could somebody - perhaps outside this list - provide a serious | example showing the *necessity* for RandomIO() - the Monadic, | "side-effect" version? In a pure functional language? Well, I'm not outside this list ;-). Honestly, there is no necessity for using the IO monad, it is just a matte

Re: Random comments

1998-12-03 Thread Joe Fasel
| I think using monads, and specially a powerful one like IO, everywhere is | a mistake. I can't see the need for most uses of random numbers. | | -- Lennart Besides that, isn't the name "randomIO" a bit unfortunate? It sounds like it contrasts with "sequentialIO". --Joe Joseph H. Fasel

Random comments

1998-12-03 Thread Jerzy Karczmarczuk
Could somebody - perhaps outside this list - provide a serious example showing the *necessity* for RandomIO() - the Monadic, "side-effect" version? In a pure functional language? I use random numbers from time to time. I have always used sequences, lazily generated. No problem with the seed inj