Take a look at Blockspring - you do need to install the plugin, but then it's just another function you call like this:
=BLOCKSPRING("twodee-array-reduce","input_array",D5:F7)
The source code and other details are here.
If this doesn't suit and/or you want to build off my solution, you can fork
my function (Python) or use another supported scripting language (Ruby
, R
, JS
, etc...).