Tuesday, May 31, 2011

Sum of a list when boundry is given

sigma::Int->Int->Int
sigma x y = foldr(+) 0 (map (^2) [x..y])

No comments:

Post a Comment