Re: list of lists as arrays - creating?
Re: list of lists as arrays - creating?
- Subject: Re: list of lists as arrays - creating?
- From: Nigel Garvey <email@hidden>
- Date: Wed, 3 Apr 2002 07:45:39 +0100
Arthur J Knapp wrote on Tue, 02 Apr 2002 12:44:21 -0500:
>
[Addendum to Paul's Side issue: Here is an example of a constructed
>
script object whose methods should give you faster access to it's
>
items.]:
>
>
on newArrayXY(x, y)
>
>
script ArrayXY
>
>
property thisArray : {}
>
>
on GetAt(x, y)
>
return my thisArray's item x's item y
>
end GetAt
>
>
on SetAt(x, y, v)
>
set my thisArray's item x's item y to v
>
end SetAt
>
>
end script
>
>
repeat (x) times
>
set ArrayXY's thisArray's end to {}
>
repeat (y) times
>
set ArrayXY's thisArray's item -1's end to 0
>
end repeat
>
end repeat
>
>
return ArrayXY
>
>
end newArrayXY
Nice one, Arthur. :-)
May I suggest the following speed tweek for the nested repeat? It makes
the inner loop about four times as fast (AS 1.6):
repeat (x) times
set ArrayXY's thisArray's end to {}
tell the result
repeat (y) times
set its end to 0
end repeat
end tell
end repeat
Alternatively, the telling can be arranged like this:
repeat (x) times
tell {}
set ArrayXY's thisArray's end to it
repeat (y) times
set its end to 0
end repeat
end tell
end repeat
NG
_______________________________________________
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.