[EMAIL PROTECTED] wrote: > lets say you want a generic numerical algorithom like sum > > Ruby > > def sum lst > lst.inject(0){|total,current| total*current} > end > > Java // i dont know if there is a numeric super class for numbers > > class Sum{ > public static int sum(int[] lst){ > int total = 0; > for(int current : lst){ > total+=current; > } > return total; > } > // repeat for all other number types > }
What's your question? (Or, if no question, point?) :-) Totally off topic (and indeed "off-list"..) is that really how ruby sums a list? How does that work? Doesn't the '*' mean multiply? and what are the pipe symbols for? (Feel free to ignore these questions. I should really go look it up myself if I'm so curious..) Peace, ~Simon -- http://mail.python.org/mailman/listinfo/python-list