function sign{T<:Integer}(perm::AbstractVector{T})
L = length(perm)
crosses = 0
for i = 1:L
for j = i+1 : L
crosses += perm[j] < perm[i]
end
end
return iseven(crosses) ? 1 : -1
endThanks for the code – would you be willing to contribute it under the MIT license?