diff --git a/src/TupleTools.jl b/src/TupleTools.jl index f5511a4..e55c893 100644 --- a/src/TupleTools.jl +++ b/src/TupleTools.jl @@ -250,7 +250,8 @@ end _sort(t::Tuple{Any}, lt=isless, by=identity, rev::Bool=false) = t _sort(t::Tuple{}, lt=isless, by=identity, rev::Bool=false) = t -function _split(t::NTuple{N}) where N +function _split(t::Tuple) + N = length(t) M = N>>1 ntuple(i->t[i], M), ntuple(i->t[i+M], N-M) end diff --git a/test/runtests.jl b/test/runtests.jl index e40a4c2..976e1d1 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -77,3 +77,5 @@ end @test @inferred(TupleTools.diff(())) == () @test @inferred(TupleTools.diff((1, ))) == () @test @inferred(TupleTools.diff((1, 2, 3))) == (1, 1) + +@test TupleTools.sort((2,1,3.0)) === (1,2,3.0) \ No newline at end of file