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
> 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
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
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
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
| 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
> 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.
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
| 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
> 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
| > 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
> 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
| 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
| 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
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
15 matches
Mail list logo