• 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
Re: Alphabetizing a List
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alphabetizing a List


  • Subject: Re: Alphabetizing a List
  • From: "Marc K. Myers" <email@hidden>
  • Date: Mon, 28 May 2001 09:15:15 -0400
  • Organization: [very little]

> Date: Thu, 24 May 2001 23:41:52 +0200
> To: Eric Schult <email@hidden>, <email@hidden>
> From: Emmanuel <email@hidden>
> Subject: Re: Alphabetizing a List
>
> At 14:54 +0200 21/05/01, Eric Schult wrote:
> >
> >Is there are painless way to alphabetize a list?
>
> In case you did not get a reply:
>
> -------------------------------
> on sort(l)
> if length of l > 1 then return l
> set x to item 1 of l
> set ll to rest of l
> set l1 to {}
> set l2 to {}
> repeat with i in ll
> if x < i then
> set l2 to l2 & i
> else
> set l1 to l1 & i
> end if
> end repeat
> if length of l1 > 1 then set l1 to sort(l1)
> if length of l2 > 1 then set l2 to sort(l2)
> return l1 & x & l2
> end sort
> -------------------------------
>
> set theList to {"painless", "way", "to", "alphabetize", "a", "list"}
> sort(theList)
> -- {"a", "alphabetize", "list", "painless", "to", "way"}
>
> HTH
> Emmanuel

I tried this script and got the original list as the result. The sort
handler never got past "if length of l > 1 then return l" because the
list had more than one item.


  • Prev by Date: <ANN> Dialog Studio 2.0 released
  • Next by Date: Re: Alphabetizing a List
  • Previous by thread: Re: Alphabetizing a List
  • Next by thread: Re: Alphabetizing a List
  • Index(es):
    • Date
    • Thread