WIP: min, max, sum, prod, mean etc on dimensions

First pass at implementing the `Dim` type from the discussion #2265. For an array A, you can now call, e.g.: `max(A, Dim(1))`. The `Dim` can be constructed with integers,
arrays, ranges, or tuples, so all of the following are valid:
```
Dim(1)
Dim(1, 2)
Dim([1])
Dim([1,2])
Dim([1 2])
Dim(1:2)
```

I seem to have broken something with BitArrays which I am yet to figure out.

Still need to modify `cumsum` and `cumprod`. All the stats functions need similar updates.