• 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: Change the mod result in list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Change the mod result in list


  • Subject: Re: Change the mod result in list
  • From: Michelle Steiner <email@hidden>
  • Date: Thu, 22 Aug 2002 10:54:22 -0700

Here is one (brute force) way:

set integerList to {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
set N to 4
set resultList to {}
repeat with i in integerList
set foo to i mod N
if foo is 0 then set foo to 4
set end of resultList to foo
end repeat

Or you can do it this way:

set integerList to {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
set N to 4
set resultList to {}
repeat with i in integerList
set end of resultList to (i mod N) + 4 * ((i mod N = 0) as integer)
end repeat

--Michelle

On Thursday, August 22, 2002, at 10:14 AM, bill wrote:

Is there any possible way to convert each 0 to 4? Like this one:
We're not human beings having a spiritual experience.
We're spiritual beings having a human experience.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Change the mod result in list
      • From: bill fancher <email@hidden>
    • Re: Change the mod result in list
      • From: bill <email@hidden>
References: 
 >Change the mod result in list (From: bill <email@hidden>)

  • Prev by Date: Re: Interesting observation in OS X scripts menu
  • Next by Date: Re: Change the mod result in list
  • Previous by thread: Re: Change the mod result in list
  • Next by thread: Re: Change the mod result in list
  • Index(es):
    • Date
    • Thread