myfoldl _ v [] = vmyfoldl f v (x:xs) = myfoldl f (f v x) xs mysum = myfoldl (+) 0 sumlist xs = [mysum [1..x] | x <- xs] mytake 0 _ = []mytake n (x:xs) = x:mytake (n - 1) xs main = print (mytake 10 (sumlist [1..1000000]))
Standard input is empty
[1,3,6,10,15,21,28,36,45,55]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!