• 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: list of lists as arrays - creating?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: applescript-users digest, Vol 3 #313 - 1 msg
  • Next by Date: Re: Shell script date & time coercions...
  • Previous by thread: Re: list of lists as arrays - creating?
  • Next by thread: Re: list of lists as arrays - creating?
  • Index(es):
    • Date
    • Thread