The Directory Walker revisited
wouter
wouter.abraham at pi.be
Thu Sep 4 03:53:00 EDT 2003
On donderdag, sep 4, 2003, at 00:55 Europe/Brussels,
use-revolution-request at lists.runrev.com wrote:
> Message: 14
> Date: Thu, 04 Sep 2003 09:34:33 +1000
> From: David Vaughan <dvk at dvkconsult.com.au>
> Subject: Re: use-revolution digest, Vol 1 #1865 - 13 msgs
> To: use-revolution at lists.runrev.com
> Reply-To: use-revolution at lists.runrev.com
>
>
snip
> Your comments above puzzle me. I have no need to post the URL because
> you just did. When I click on the url you posted I go to the routine I
> wrote and published myself. It does not mention, point to, and is not
> derived from, anything by Ben.
>
> While always a theoretical possibility, it is nigh-impossible in
> practice that this will bump into a limit, the default recursion depth
> allowing for over 700 directories deep, as Dar has mentioned.
>
> Further, it is a real recursive handler, pre-order, depth-first. The
> fact it is a function is normal for a recursive routine which returns
> data.
>
> The repeat loops within it simply list the files within the directory
> at which you have just arrived (pre-order process) and steps through
> the immediate sub-folders for depth-first recursive searching. What
> here is "not real"?
>
> Finally, it works without "correction". I know because (a) I just
> copied and pasted the code into a test stack and ran it successfully
> and (b) it is the code I already use in other stacks anyway; with zero
> problems of course.
>
> I appreciate your interest in the topic but not the mis-statements
> about recursion or my code.
First let me appologize because you seem to be a bit offended by my
statements.
Please forgive me as English is not my native language.
But the part :
< which points to Ben Rubinstein's directory walking function.
Which is not a real recursive handler, but a repeat loop buried in a
function.
Only this script as it is, will not work and has to be corrected. >
does not point to you or your code. As a matter of fact your code
works perfectly
up to the recursionLimit (I am already sorry for saying this).
It points to the handler of Ben Rubinstein. And I am not accusing him
either
(please give me some slack). The problem with his handler is the
following line:
if char 1 of x <> "." then
put ("/" & subPath) & return after folders2do #### problem
line
end if
If you step trhough the code you will see why.
Then there is the problem of the use of the term "recursion".
A repeat loop is recursive and a handler can be recursive if it calls
itself.
But here are 2 different mechanisms at work. And that's why there is a
huge difference
between the 2.
So I know the function is using recursion inside the repeat loop but is
not recursing by calling itself.
That's why I did call it a non recursive "handler/function". No offense
meant.
> regards
> David
Greetings,
WA
More information about the use-livecode
mailing list