[REBOL] Re: variable scopes and recursive func
From: mokkel:gmx at: 12-Apr-2005 1:05
Hi Janeks,
why don't you simply use just the depth parameter to the function and if
you recurse down the directory tree add always one to the depth value.
Then you can do in the function whatever you like with the depth parameter
and you don't need a local parameter.
It's anyway not clear to me how your output is supposed to look exactly.
What about this version, which works but still gives some kind of
senseless output ?
readChaptDir2: func [ thisDir depth
/local rez bl
] [
rez: copy thisDir
bl: sort read thisDir ;separate to be able to see what happends
probe bl ;just for debugging
repeat aFile bl copy/deep [
print aFile ;just for debugging
either #"/" = last aFile [
repend rez [ "<br>dir:" join thisDir aFile depth + 1 ]
repend rez readChaptDir2 join thisDir aFile (depth + 1
][
repend rez [ <br> aFile ]
]
]
return rez
]
readChaptDir2 %somedir/ 0
Michael
On Mon, 11 Apr 2005 23:55:54 +0300, <[sags--apollo--lv]> wrote: