106 107 108 109
# File 'lib/alib-0.5.1/stdext.rb', line 106 def product n = 1 return 0 if empty? inject(n){|n,i| n *= i} end
103 104 105
# File 'lib/alib-0.5.1/stdext.rb', line 103 def sum n = 0 inject(n){|n,i| n += i} end