Is there a Mathematica function like injectin Ruby? For example, if I want a product of items in a list, in Ruby I can write:
list.inject(1) { |prod,el| prod * el }
I found what I can use Productin Mathematica:
Apply[Product, list]
However, for me this is not enough for me (for example, if I do not just want a product or a sum of numbers). What is the closest equivalent inject?
source
share