Re: How do I make words list from two lists?
Re: How do I make words list from two lists?
- Subject: Re: How do I make words list from two lists?
- From: Shane Stanley via AppleScript-Users <email@hidden>
- Date: Mon, 23 Sep 2019 09:51:37 +1000
On 23 Sep 2019, at 7:35 am, Nigel Garvey via AppleScript-Users
<email@hidden> wrote:
>
> Of course, one should make sure the TIDs are to "" during the coercions.
Indeed so.
> Alternatively, the letter list could be coerced to text and the
> substrings extracted directly from it:
Surprisingly -- to me at least -- that approach is actually a *fraction* slower
in a quick test here. I would have expected the opposite.
Here's a different approach that is quite a bit slower, but, well, because:
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
set alist to {"T", "h", "e", "q", "u", "i", "c", "k", "b", "r", "o", "w", "n",
"f", "o", "x"}
set bList to {1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4}
set string_list to {}
set indexCounter to 1
set startCounter to 1
set theSet to current application's NSCountedSet's alloc()'s initWithArray:bList
repeat
set theCount to (theSet's countForObject:indexCounter)
if theCount = 0 then exit repeat
set end of string_list to (items startCounter thru (startCounter +
theCount - 1) of alist) as text
set indexCounter to indexCounter + 1
set startCounter to startCounter + theCount
end repeat
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>
_______________________________________________
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