Re: bug in sort?
- To: mathgroup at smc.vnet.net
- Subject: [mg81616] Re: bug in sort?
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Sat, 29 Sep 2007 02:31:40 -0400 (EDT)
- Organization: Uni Leipzig
- References: <fdi68j$rak$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi, you wrote "OR Sort should fail" Sort[] can't fail when you give a relation the is unambiguous. In all other cases the result is more or less arbitrary. And this happends -- you can't Sort[] your list becauses there is no unique relation between the elements. Regards Jens P_ter wrote: > Hello, > I have a list: > tlst = {{10, 1, {4}}, {11, 1, {5}}, {14, 1, {2}}, {23, 1, {3}}} > It is about intervals. The element {10,1,{4}} means: at the number 10 only one (1) interval starts with lenght 4. I want to order this list. 10+4 should be smaller or equal than the beginning of the next list. So, the order could succeed OR fail. I prefer a fail, because: > {{10,1,{4}}, {14,1,{2}}, {23,1,{3},{11,1,{5}}} > Default all the elements which do not fit in my rule should be in the end OR Sort should fail. In my thinking some rules are impossible to satisfy. > For that: > Sort[tlst, (#1[[1]] + #1[[3, 1]] <= #2[[1]]) &] > gives: {{14, 1, {2}}, {11, 1, {5}}, {10, 1, {4}}, {23, 1, {3}}} > I do not understand this. > Can anyone help me? > with friendly greetings, > P_ter >