I have array of arrays and I want to sort these arrays in array by their first element. Is something like this possible in Julia?
For example i have
a = (Array{Int64, 1})[]
push!(a, [5, 2 , 3])
push!(a, [3, 1 , 4])
And i want to sort in in way that the result will be [[3,1,4], [5,2,3]. Arrays will be sorted according to their first element.
I need this because heap in Julia is unable to take arrays as element in heap. Any idea???
sort(a,by=first)works (firstis a useful function to remember). - Dan Getz