• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Sorting a list of records
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sorting a list of records


  • Subject: Sorting a list of records
  • From: Gil Dawson <email@hidden>
  • Date: Mon, 23 Aug 2010 15:58:41 -0700

Hi, Folks--

I need an algorithm to sort a list of records in a "stable" way.  By "stable", I mean

	When two keys are equal, output records are in the same order as the input.

The AppleScript 'CustomQsort' algorithm suggested by Adam Bell, Nigel Garvey, et al in (http://macscripter.net/viewtopic.php?id=17340) works well in my application except that the underlying QuickSort algorithm is intrinsically not "stable".

I looked at the "sortlist" command in Satimage.osax.  It is stable, but it sorts a list of lists, instead of a list of records.  I would need to figure a way to "coerce" a list of records to a list of lists, then back again.

Anyone have another idea?

--Gil _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Sorting a list of records
      • From: "Stockly, Ed" <email@hidden>
    • Re: Sorting a list of records
      • From: "Mark J. Reed" <email@hidden>
  • Prev by Date: Re: Remember Finder windows left open at shutdown
  • Next by Date: Re: Sorting a list of records
  • Previous by thread: Re: Daylight Savings Time
  • Next by thread: Re: Sorting a list of records
  • Index(es):
    • Date
    • Thread