The challenge is to sum the digits of an integer-style number in the fewest characters possible. Your function should take a number(assuming it is a string or an int class is allowed, just assume the argument is of the type you need) and return the sum.
For those of you who know about passing methods/procs/blocks, try allowing the function to perform any accumulative algorithm across the digits - i.e. any algorithm that keeps a running value and uses the next value to alter it. Examples would be multiplying all the digits or raising each digit to a power and then raising that value to the next digit's power and so on.
This post has been edited by xclite: 16 March 2011 - 06:19 AM