Closed dongzhiming closed 1 year ago
I am not sure whether the dominanceComparator function will become less efficient or not, I wrote it in the following way.
dominanceComparator
function dominanceComparator(x::Array{T}, y::Array{T})::Int where {T <: Number} @assert length(x) == length(y) "The arrays have a different length" x==y && return 0 all(t->(t[1]≤t[2]), zip(x, y)) && return -1 all(t->(t[1]≤t[2]), zip(y, x)) && return 1 return 0 end
It is a very concise, clear and elegant solution. I will adopt it.
I am not sure whether the
dominanceComparator
function will become less efficient or not, I wrote it in the following way.