Created
September 30, 2012 13:52
-
-
Save xenophobia/3806786 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Array.IArray | |
sumA :: Array Int Int -> Int | |
sumA ary = foldl (\acc i -> acc + ary!i) 0 (indices ary) | |
main = do | |
let ary = listArray (1, 10) [1..] :: Array Int Int | |
print $ sumA ary |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment