MACSCRPT Archives

November 2006

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
deivy petrescu <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Fri, 17 Nov 2006 18:13:26 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (62 lines)
On Nov 17, 2006, at 17:55, deivy petrescu wrote:

> On Nov 17, 2006, at 15:54, Paul Berkowitz wrote:
>
>> Perhaps some of you can help out here, or direct me to somewhere I  
>> might
>> find an answer, which will probably be in the shell script area.
>>
>
> Paul;
> I do not think you need shell.
> I believe what I propose is a variation of Emmanuel's method, which  
> I could not fully remember.
>
> this is the script and below it is the time for a list of 2000 items
> (NOTE: the script uses Smile, "chrono" will not compile without Smile)
>
>
> -- this is texto: 2000 words from 1 to 2000.
> set texto to "1"
> repeat with j from 2 to 2000
> 	set texto to texto & " " & j
> end repeat
>
> chrono
> set l to every word of texto
> ASTID(return)
> set l to l as text
> ASTID("1234")
> set ind to (count of paragraphs in text item 1 of l)
> set ch to chrono
> ASTID("")
> {ind, ch}
>
>  --  {858, 0.173509}
>   --  {1, 0.127912}
>   --  {1234, 0.12394}
>   --  {1234, 0.124827}
>   --  {1234, 0.123216}
>   --  {1234, 0.123345}
>
> ---  here texto is from 1 to 6000
>  --  {1234, 0.378821}
>   --  {4234, 0.451657}
>   --  {4234, 0.413229}
>   --  {4234, 0.384776}
>
> on ASTID(k)
> 	set AppleScript's text item delimiters to k
> end ASTID
>


Oooops! My bad, after I sent I noticed that my chrono was misplaced,  
the method is much faster than what i wrote, it returns the index of  
an item in a 6000 items list in less than 1/100 of a second.

The time above also computes the time it takes to create a 6000 items  
list.

Deivy

ATOM RSS1 RSS2