Re: Determining item number matching "x" in a list
Re: Determining item number matching "x" in a list
- Subject: Re: Determining item number matching "x" in a list
- From: Steve Cunningham <email@hidden>
- Date: Wed, 12 Mar 2003 06:11:11 -0500
>
Paul Berkowitz wrote on Tue, 11 Mar 2003 12:51:11 -0800:
>
<SNIP>
>
If the list is quite large, you can usually speed up the process by using
>
a binary search, though there are positions in all lists that a
>
straight-through loop will find more quickly. Here's a sketch from a
>
project I shelved last year. If you need case sensitivity, put the call
>
to the handler in a 'considering case' block.
>
<SNIP>
Thanks, I'll give it a try. One question though...
>
if theList does not contain searchItem then return 0
I have used this technique myself, ie why search for the item if it is
not in the list to start with (terrible grammar, but you know what I
mean), but I always have the nagging suspicion that in fact I may be
searching the list twice by doing this and not saving any time :-). That
is, to determine if the item is in the list, AppleScript has to do the
equivalent of my repeat loop, so why not just do it once and be done with
it?
Can anyone comment on the truth or falsity of this?
Steve
_______________________________________________
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.