• 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: processing time & stack overflow
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: processing time & stack overflow


  • Subject: Re: processing time & stack overflow
  • From: monk <email@hidden>
  • Date: Wed, 29 Aug 2001 05:14:22 -0400

-- 8/28/01 11:49 AM: email@hidden said:

> on 8/28/01 11:05 AM, Arthur J Knapp wrote:
>
>> on NewOrder(lst)
>> set {s1, s2, len} to ,
>> {random number from 1 to 100000, 31415, lst's length}
>> repeat with i from 1 to len
>> set {j, s1} to {(s1 mod len) + 1, (s1 * s2) mod len}
>> set {lst's item i, lst's item j} to ,
>> {lst's item j, lst's item i}
>> end repeat
>> end NewOrder
>>
>> set lst to {"a", "b", "c", "d"}
>>
>> NewOrder(lst)
>>
>
> Nice. I'm still digesting it. You do want to return the value of 'lst'
> at the end though.
> I don't see any OSAX calls. Was that in the previous version you mention?

hi paul

well, since you asked, tim's original interpretation on this thread is as
follows:

set _source to open for access (choose file with prompt "choose source to
juxtapose:")
display dialog "process by:" buttons {"line", "paragraph", "word"} default
button "word"
set _buttonreply to button returned of result
if _buttonreply is "word" then
set fileDelimitters to {return, space} --read variable as list by word
and set new variable for list manipulation
else if _buttonreply is "line" then
set fileDelimitters to {return} --read variable as list by line
(sentence)
else --"paragraph"
set fileDelimitters to {return & space} --read variable as list by
paragraph (word & line)
end if
try
set _listsource to (read _source as list using delimiter
fileDelimitters)
close access _source
on error
try
close access _source
end try
end try

--return _listsource
set _fileamount to "1"
repeat until class of _fileamount is integer and _fileamount > 0 and
_fileamount < 100
try
set _fileamount to (text returned of (display dialog "enter amount
of files to generate from source (1-99)?" default answer _fileamount giving
up after 12)) as integer
on error
display dialog "that wasn't the right kind of number!"
end try
end repeat

tell application "Finder"
activate
set _newfolder to (path to desktop as string) & "juxtatext(s)"
try
open folder _newfolder
on error
set _newfolder to (make new folder at desktop with properties
{name:"juxtatext(s)"}) as string
open folder _newfolder
end try
set size of window of folder _newfolder to {253, 527}
set view of window of folder _newfolder to kind
end tell

try
repeat with i from 1 to _fileamount
set _filename to "juxtatext " & characters -2 thru -1 of ("0" & i)
set _juxtatext to open for access file (((path to desktop) as string) &
"juxtatext(s):" & _filename) with write permission
my juxtapose(_listsource, _juxtatext)
close access _juxtatext
end repeat
on error errmsg number errNbr
try
close access _juxtatext
end try
error errmsg number errNbr
end try

on juxtapose(_listsource, _juxtatext)
set _listsource to my randomize(_listsource)
set {AppleScript's text item delimiters, oldTIDs} to {{" "}, AppleScript's
text item delimiters}
set _listsource to _listsource as string
write (_listsource) to _juxtatext starting at eof
set AppleScript's text item delimiters to oldTIDs
end juxtapose

to randomize(TheList)
repeat with i from length of TheList to 1 by -1
set current_item to (random number from 1 to i)
tell TheList -- exchange item current_item with item i
set temp to item i
set item i to item current_item
set item current_item to temp
end tell
end repeat
return TheList
end randomize

h 'monk' elmer
--
            
http://www.assemblage.org
            


  • Prev by Date: Re: processing time & stack overflow
  • Next by Date: Re: processing time & stack overflow
  • Previous by thread: Re: processing time & stack overflow
  • Next by thread: Re: processing time & stack overflow
  • Index(es):
    • Date
    • Thread