I guess you mean something like this:
julia> using Base.Order
julia> import Base.lt
julia> type MyNewOrdering<:Ordering
end
julia> f(x::Float64)=x
f (generic function with 1 method)
julia> lt(o::MyNewOrdering,x::Float64,y::Float64)=f(x)<f(y)
lt (generic function with 9 methods)
julia> a=rand(1000000)
1000000-element Array{Float64,1}:
...
julia> @time sort(a,order=MyNewOrdering())
elapsed time: 0.119845282 seconds (8000496 bytes allocated)
1000000-element Array{Float64,1}:
...
Yes, that's better, both time and memory allocation. Thank you very much!
:-)
Am Donnerstag, 3. Juli 2014 21:14:05 UTC+2 schrieb Stefan Karpinski:
>
> You can also define your own subtype of Order. See base/order.jl.
>
>