Re: Adding To A List
Re: Adding To A List
- Subject: Re: Adding To A List
- From: Malcolm Fitzgerald <email@hidden>
- Date: Thu, 2 Jun 2005 18:07:24 +1000
On 02/06/2005, at 5:27 PM, DigitEL wrote:
Can anyone suggest why the following code which I am trying to create
a list of incremented lists returns a list with all of the contained
lists equal to the last list incremented?
set currentList to {1, 2, 3, 4}
repeat until (item 1 of currentList) is greater than or equal to the
stopCount
set item 1 of currentList to ((item 1 of currentList) + the
nextIncrement)
set item 3 of currentList to ((item 3 of currentList) + the
nextIncrement)
set the end of the newList to currentList
end repeat
Do you want it to do something like this:
set nextIncrement to 1
set stopcount to 6
set currentList to {1, 2, 3, 4}
set newList to {}
set tmpList to {}
repeat until (item 1 of currentList) is greater than or equal to the
stopcount
set tmpList to {(item 1 of currentList) + nextIncrement, item 2 of
currentList, (item 3 of currentList) + nextIncrement, item 4 of
currentList}
set currentList to tmpList
set end of newList to tmpList
end repeat
newList --> {{2, 2, 4, 4}, {3, 2, 5, 4}, {4, 2, 6, 4}, {5, 2, 7, 4},
{6, 2, 8, 4}}
Malcolm Fitzgerald ph: 02 93180877
Database Manager fax: 02 93180530
The Australian Society of Authors www.asauthors.org
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden