• 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: Permutation Handler
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Permutation Handler


  • Subject: Re: Permutation Handler
  • From: Jed Verity <email@hidden>
  • Date: Thu, 15 Feb 2001 11:26:04 -0800

That's the one! You're a life-saver.
Jed

On 2/15/01 11:13 AM, Arthur J Knapp uttered these immortal words:

> set integerList to {1, 2, 3, 4}
>
> set thePermutations to {} -- collect them in here
>
> permutateList(integerList, 1, thePermutations)
>
> thePermutations
> -- > {{1, 2, 4, 3}, {1, 2, 4, 3}, ...
>
> on permutateList(lst, x, col)
> if (x = length of lst) then
> set end of col to lst
> else
> repeat with i from x to length of lst
> copy lst to lst -- don't pass ref/data share
> set {lst's item x, lst's item i} to ,
> {lst's item i, lst's item x}
> permutateList(lst, x + 1, col)
> end repeat
> end if
> end permutateList


~)~)~)~)~)~)~)~)~)~)~)~)~)
Jed Verity


References: 
 >Re: Permutation Handler (From: "Arthur J Knapp" <email@hidden>)

  • Prev by Date: Re: Permutation Handler
  • Next by Date: Re: Calling an Application - Again
  • Previous by thread: Re: Permutation Handler
  • Next by thread: Choose a file dialog box?
  • Index(es):
    • Date
    • Thread