Add function to return the sum of an array more painlessly.

This makes is a bit easier to return the sum of an array. I hope it will be merged into master. We could also use an ``average`` function for arrays too, I think.