MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

bug in sort?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81578] bug in sort?
  • From: P_ter <peter_van_summeren at yahoo.co.uk>
  • Date: Fri, 28 Sep 2007 02:11:20 -0400 (EDT)

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


  • Prev by Date: Re: Mellin Transform
  • Next by Date: Re: create a list with x,y,z coordinates
  • Previous by thread: Re: CompleteCharacters Palette in v6?
  • Next by thread: Re: bug in sort?