
5 Nov
2007
5 Nov
'07
4:04 p.m.
On Mon, Nov 05, 2007 at 01:42:50PM -0700, Luke Palmer wrote:
On Nov 5, 2007 1:30 PM, Jonathan Cast
wrote: Get an infinite list of pairs
let pairs = [ (x, y) | x <- randoms (-1, 1) g0, y <- randoms (-1, 1) g1 ]
This will return a list like [(a,b),(a,c),(a,d),(a,e),...]. This needs to be a parallel comprehension:
let pairs = [ (x,y) | x <- randoms (-1,1) g0 | y <- randoms (-1,1) g1 ]
Or even better, just don't use list comprehensions, they're confusing: let pairs = zip (randoms (-1,1) g0) (randoms (-1,1) g1) Now you don't have to think backwards to figure out what the comprehension is doing. -- David Roundy Department of Physics Oregon State University