Skip to content

Commit 8e9d0c4

Browse files
authored
Sorting across different datatypes (#17)
* Update TupleTools.jl * Update runtests.jl * fix
1 parent 0b1147f commit 8e9d0c4

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/TupleTools.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ end
250250
_sort(t::Tuple{Any}, lt=isless, by=identity, rev::Bool=false) = t
251251
_sort(t::Tuple{}, lt=isless, by=identity, rev::Bool=false) = t
252252

253-
function _split(t::NTuple{N}) where N
253+
function _split(t::Tuple)
254+
N = length(t)
254255
M = N>>1
255256
ntuple(i->t[i], M), ntuple(i->t[i+M], N-M)
256257
end

test/runtests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,5 @@ end
7777
@test @inferred(TupleTools.diff(())) == ()
7878
@test @inferred(TupleTools.diff((1, ))) == ()
7979
@test @inferred(TupleTools.diff((1, 2, 3))) == (1, 1)
80+
81+
@test TupleTools.sort((2,1,3.0)) === (1,2,3.0)

0 commit comments

Comments
 (0)