[Haskell-cafe] How to improve its performance ?
ajs at 2piix.com
Thu Mar 18 00:03:28 EDT 2010
On Mar 17, 2010, at 8:33 PM, zaxis wrote:
> `allPairs list = [(x,y) | x <- list, y <- list] ` is not what
> does !
>> let allPairs list = [(x,y) | x <- list, y <- list]
>> allPairs [1,2,3]
Yeah, I know that. I said so specifically. combination computes the
power set of a list. You said your goal was to compute a set of "two
groups". You don't need the power set in order to compute a set of
pairs. Moreover, computing the power set is a slow operation.
Indeed, it is the source of your slowness.
More information about the Haskell-Cafe