Thanks Steven for fixing this.

(If you pass them keyword arguments, then they pretty much have to return a 
> full array, rather than try to be clever and return another range, for 
> type-stability.  e.g. sort(-5:5, by=abs) can't be expressed in terms of a 
> range.)


At first I didn't understand this, until I came around to understanding 
that keyword arguments don't participate in dispatch.
So it's not possible to specialise on a *particular* keyword. It's all or 
nothing.
I guess this make keyword arguments slightly less useful in some 
circumstances.

For my purpose, I defined my own reverse sort so that I could specialise:

sortrev(v::AbstractVector) = sort(v, rev=true)
sortrev(r::Range) = issorted(r) ? reverse(r) : r

Reply via email to