[Haskell-cafe] How to improve its performance ?

zaxis z_axis at 163.com
Wed Mar 17 19:53:28 EDT 2010


import Data.List

combination :: [a] -> [[a]]
combination [] =  [[]]
combination (x:xs) =  (map (x:) (combination xs) )++ (combination xs)

samp = [1..100]
allTwoGroup = [(x, samp\\x) | x <- combination samp]

The above code is used to calculate all the two groups from sample data ? It
is very slow !

Sincerely!

-----
fac n = let {  f = foldr (*) 1 [1..n] } in f 
-- 
View this message in context: http://old.nabble.com/How-to-improve-its-performance---tp27940036p27940036.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list