Recent

Author Topic: Custom sort, is this a bug?  (Read 930 times)

y.ivanov

  • Hero Member
  • *****
  • Posts: 562
Re: Custom sort, is this a bug?
« Reply #15 on: September 05, 2022, 07:38:09 pm »
*snip*
I think there is an error in your loop when the list has an even count of items.
*snip*
You're right, the loop must be less by one:
Code: Pascal  [Select][+][-]
  1.   J := List.Count;
  2.   for I := 0 to Pred(J div 2) do
  3.     List.Exchange(I, Pred(J) - I);

But my question was whether Thaddy wants to just reverse the list by playing tricks with CustomSort.
"I'm sorry Dave, I'm afraid I can't do that."
—HAL 9000

Thaddy

  • Hero Member
  • *****
  • Posts: 12208
Re: Custom sort, is this a bug?
« Reply #16 on: September 21, 2022, 06:51:02 pm »
Well, reversing a list is a common pattern.
Manuals, manuals, manuals first.
You have incompetence and sheer incompetence.

 

TinyPortal © 2005-2018