Use Clojure's "group-by" in $group-by for speed

Change $group-by so that it uses the builtin group-by function and add
tests for $group-by. Now substantially faster for some datasets.