Re: recursion depth
Re: recursion depth
- Subject: Re: recursion depth
- From: Matt Neuburg <email@hidden>
- Date: Tue, 11 Oct 2005 10:10:07 -0700
- Thread-topic: recursion depth
On Mon, 10 Oct 2005 12:56:27 +0100, "Nigel Garvey"
<email@hidden> said:
>has wrote on Sun, 9 Oct 2005 22:18:54 +0100:
>
>>FWIW, the only situation I can think of offhand where call stack overflows
>>are a significant problem for ASers are in recursive sort routines such as
>>quicksort. And you can avoid those by using non-recursive algorithms instead
>
>Or an intelligent mixture. Recursive algorithms seldom need to go very
>deep -- as I believe you're saying. There's often a lot of to-ing and fro-
>ing between the different levels, but the maximum depth is usually not
>very much. Even on a Jaguar machine -- which allows 248 levels by Matt's
>script -- the quicksort that Arthur Knapp and I wrote a couple of years
>ago can sort a million items without running into trouble.
Examples as in my book, where recursion is used as a cute way of traversing
a list, are somewhat artificial and impractical, because in a *real*
recursive language such as LISP when you cdr down the list recursively the
tail-recursion is reimplemented iteratively behind your back. AppleScript
doesn't do that. But then, that's exactly the phenomenon that got me curious
about this in the first place.
m.
PS In Smile, I got 8159 for my code (as reported by others).
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden