JuliaLang/julia — pull request #6700 by karbarcca (2014-04-30 20:00:40+00:00)
Title: Tweaks to StepRange: Take 2

The `issorted` and `in` changes are pretty straightforward, using the step for comparison. `sort` and `sortperm` remove the `T<:Real` restriction to apply to `StepRange` as well. All `test/ranges.jl` tests still pass with these changes, though I can add some more and try to break things if needed.

The introduction of `steprem` is annoying, but surprisingly minimal to allow full support for different step types than the difference between start and stop. The reasoning is that most Ordinal types shouldn't have to worry because the fallback to `(stop-start) % step` should work, but it allows for overloading (similar to how I'm overloading `length`).

Fixes #6638

cc: @JeffBezanson

Support methods I'm using to get range functionality for dates: https://github.com/karbarcca/Dates.jl/blob/master/src/periods.jl#L115
Relevant tests the date ranges are passing with these changes: https://github.com/karbarcca/Dates.jl/blob/master/test/runtests.jl#L1343