[julia-users] Re: Sort function

2016-01-20 Thread Sisyphuss
>From the error information, the comparison of Array is not implemented yet. On Wednesday, January 20, 2016 at 4:48:40 PM UTC+1, Ted Fujimoto wrote: > > Hi, > > In Python, we have this: > > >>> sorted([(1, [2,3]), (1,[2,1])]) > [(1, [2, 1]), (1, [2, 3])] > > In Julia, this produces a MethodError:

[julia-users] Re: Sort function

2016-01-20 Thread Tim Wheeler
You should be able to write your own Base.isless function for the types you need to support. On Wednesday, January 20, 2016 at 7:48:40 AM UTC-8, Ted Fujimoto wrote: > > Hi, > > In Python, we have this: > > >>> sorted([(1, [2,3]), (1,[2,1])]) > [(1, [2, 1]), (1, [2, 3])] > > In Julia, this produce

Re: [julia-users] Re: Sort function

2016-01-20 Thread Stefan Karpinski
We used to have lexicographic sorting of arrays but removed it. I don't recall the reasoning. On Wed, Jan 20, 2016 at 11:22 AM, Tim Wheeler wrote: > You should be able to write your own Base.isless function for the types > you need to support. > > > On Wednesday, January 20, 2016 at 7:48:40 AM U

Re: [julia-users] Re: Sort function

2016-01-20 Thread Ted Fujimoto
Got it. Thanks! On Wed, Jan 20, 2016 at 11:33 AM Stefan Karpinski wrote: > We used to have lexicographic sorting of arrays but removed it. I don't > recall the reasoning. > > On Wed, Jan 20, 2016 at 11:22 AM, Tim Wheeler > wrote: > >> You should be able to write your own Base.isless function fo

Re: [julia-users] Re: Sort function

2016-01-20 Thread Pablo Zubieta
I don't know why it was removed, but if you need that to work you can define function Base.isless(A::AbstractVector, B::AbstractVector) a, b = length(A), length(B) a == 0 && return b > 0 for i in 1:min(a,b) A[i] != B[i] && return A[i] < B[i] end return a < b end and th