Re-implement reduce.

Consolidates the implementation, prepares for "fold", and also fixes a couple of issues:
http://forum.dlang.org/thread/oghtttkopzjshsuflelk@forum.dlang.org
https://issues.dlang.org/show_bug.cgi?id=10709
https://issues.dlang.org/show_bug.cgi?id=12569
Reduce unittest for 10709, 12569, and...

...an unfiled issue from the forums
Use `assertThrown` in reduce unittest
Merge pull request #2060 from monarchdodra/reduceReimpl

Re-implement reduce