Re: AppleScript script unable to respond to a script statement correctly
Re: AppleScript script unable to respond to a script statement correctly
- Subject: Re: AppleScript script unable to respond to a script statement correctly
- From: Nigel Garvey <email@hidden>
- Date: Mon, 25 Jun 2018 10:41:33 +0100
Deivy Petrescu wrote on Sun, 24 Jun 2018 17:33:44 -0400:
>Nigel
>Am I missing something?
>
>Why are the lines
> set (contents of itemRef) to missing value —a problem here!
>
>and
>
>set RecList to every record of RecList
>
>needed?
Sorry I left Ilja's comment in there. I didn't notice until after I'd
posted.
>If you remove them the script is shorter and it works,
Mmm. So it does. Ilja's script originally required each record added to
the destination list to be removed from the source list so that the
latter's length could be used to identify the next record for transfer
and to tell when the process was complete. When I optimised it to
decrement a variable instead of counting the reduced list every time, it
didn't occur to me that the list actually no longer needed to be reduced.
>probably faster then
>this.
Surprisingly, no. There's no measurable difference, of course, when the
list only contains nine records as here. When it's extended to
seventy-two discrete records with 'ParagraphPosition' values covering
all the integers between 1 and 72, I get a pretty constant running time
of 0.024 seconds when the two lines are removed. It's the same whatever
the initial order of the records because the script has to do the same
amount of looping and comparing overall whatever happens.
When the two lines are kept and RecList's length is reduced by 1 every
time, there are best- and worst-case scenarii. The best is when the
records are in the required order anyway. In this case the inner repeat
only ever examines the first record in the list as it exists at the
time. I get an overall running time of 0.002 seconds when this happens.
The worst case is when the initial order's the exact reverse of what's
required. In this case the inner loop has to examine every single
remaining record every time. Even so, the overall time I'm getting is
only 0.017 seconds — about two thirds of the time taken when the lines
are removed and the list isn't shortened. I've no idea why this should
be. :/
>By the way, congrats on the victory :-)
Thanks! :) But I have to admit that only four of our goals were due to
England's superior playing skills. The other two were from penalties
occasioned by the Panamanians' blatant and atrocious fouls! Fingers
crossed for when we meet the better teams ….
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden