The sorting of Tuples

If I have an array of tuples, all of type Tuple{Int, X, X} where X is any other type. When I sort them with julia’s sort! api, can I rely on it to sort them by the first Int (I want the first Int to be treated as a rank)?

Yes.

2 Likes

Although note that if you have any identical integers, then it’ll try to compare the next object(s) and sort on those.

2 Likes

This really needs to be documented: https://github.com/JuliaLang/julia/issues/24330

1 Like