Make view functions erica-compatible.

reduce cannot seem to have functions outside the main function
JSHint
Use built-in _sum reduce for 1d arrays