Re: Euphoria's identity/philosophy -- Where is the focus?

new topic     » goto parent     » topic index » view thread      » older message » newer message
jimcbrown said...
Spock said...

sort_columns() - NOT stable, in fact, worthless for business apps or anything where the correctness of the end data is paramount.

Can you give examples where the end data is incorrect? ..

 
sequence testdata = 
{ {1,1}, 
  {2,1}, 
  {2,2}, 
  {1,2}, 
  {3,1}, 
  {2,3}, 
  {2,4}, 
  {1,3}, 
  {2,5}, 
  {3,2} } 
 
? sort_columns(testdata, {1}) 
 
 
-- Result: 
 
{ {1,1}, 
  {1,2}, 
  {1,3}, 
  {2,2}, -- 1 
  {2,4}, -- 2 
  {2,1}, -- 3 
  {2,5}, -- 4 
  {2,3}, -- 5 
  {3,1}, 
  {3,2} } 
 

The elements for the middle block are completely jumbled up. The commented numbers show what should have been in the 2nd column, if the sort were stable.

I wonder why nobody picked this up sooner? Of course, it did give me a chance to have a good rant..

Spock

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu