Implement groupBy.

This is the preliminary implementation of chunkBy taken from my calendar example program. Several people have expressed interest in including it in Phobos, so here it is.

It probably needs some cleanups, though; refInputRange, for example, should be put in a common place so that other Phobos unittests can use it. And we should probably create analogues for forward/bidi/random-access ranges too. (Unless these wrappers are already present somewhere and I'm just ignorant of it?)
`savePrev` and `prev` should probably be private