Re: processing time & stack overflow
Re: processing time & stack overflow
- Subject: Re: processing time & stack overflow
- From: monk <email@hidden>
- Date: Wed, 29 Aug 2001 05:15:17 -0400
-- 8/28/01 12:06 PM: email@hidden said:
>
On 8/28/01 8:49 AM, "Paul Skinner" <email@hidden> wrote:
>
>
> 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?
>
>
>
'random number' is an osax call from Standard Additions. It's not a
>
3rd-party osax, but it is an osax nevertheless. Arthur mentions it because
>
osax calls, to Standard Additions as to any other osax, are somewhat
>
time-and-memory-demanding if you are going to repeat it thousands of times,
>
and if you're counting (Arthur is always counting).
well that helps clarify why it was log-jamming along, is there a way around
this, like assigning every item to a distribution formula, that might not be
random but give me close enough results then?
thanks
h 'monk' elmer
--
http://www.assemblage.org