Change the mod result in list
Change the mod result in list
- Subject: Change the mod result in list
- From: Michelle Steiner <email@hidden>
- Date: Fri, 23 Aug 2002 10:52:24 -0700
On Thursday, August 22, 2002, at 11:56 PM, bill fancher wrote:
But for N = 5 we get {1, 2, 3, 4, 4, 1, 2, 3, 4, 4, 1, 2} which is
probably not really the desired result. If we change that line to:
set end of resultList to (i mod N) + N * ((i mod N = 0) as integer)
(which I suspect you meant to write) then we get {1, 2, 3, 4, 5, 1, 2,
3, 4, 5, 1, 2}.
Yeah, I was over focusing focusing on the specific case.
As long as integerList has only positive values, as above, we can just
do:
set end of resultList to 1 + (i - 1) mod N
True; and that's overall a better solution.
Too bad Appleworks doesn't have an absolute value function.
Here's one:
(a * ((a < 0) as integer) * -1) + a * ((a > 0) as integer)
Here's another:
if a < 0 then set a to -a
--Michelle
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.