[Haskell] Parallel list comprahensions

Iavor Diatchki iavor.diatchki at gmail.com
Tue Apr 25 13:29:06 EDT 2006


Hello,
Does the parallel list comprahension notation support guards that
involve both variables that are being generated?  I was trying to
write something that is essentially:
[ f x y | (x,y) <- zip xs ys, p x y ]
and I thought that it would be nice to rewrite it as a parallel list
comprahension, but I am stuck on the `p x y` part.  I can define my
own function to do that:
pzip f p xs ys = concat (zipWith zipper xs ys)
  where zipper x y = if p x y then [f x y] else []
or use the normal list comprahension version so it is not a problem,
but I thought I'd check if there already was a notation that I didn't
know about.
-Iavor


More information about the Haskell mailing list