Which of these would be more costly for a long list?

f :: [Int] -> [Int]
f [x] = [x]
f (x:xs) = x + (head xs) : f xs

f :: [Int] -> [Int]

f [x] = [x]

f (x:y:xs) = x + y : f (y:xs)

Michael






      
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to