[REBOL] Re: variable scopes and recursive func
From: vincent_ecuyer::yahoo::com at: 11-Apr-2005 0:09
Hi Janeks,
> readChaptDir2: func [ thisDir ] [
> rez: copy thisDir
'rez is a %filename here ('copy don't change the datatype,)
so result string is a very long %filename !
> repend rez [ "<br>dir:" join thisDir aFile ]
'rez is already initialized with the full dir name,
you don't need to add it.
instead of using copy/deep, you can replace 'repeat by 'foreach,
so your function becomes:
readChaptDir2: func [ thisDir /local rez ] [
rez: to-string thisDir
foreach aFile read thisDir [
either #"/" = last aFile [
repend rez "<br>dir:"
repend rez readChaptDir2 join thisDir aFile
][
repend rez [ <br> aFile ]
]
]
return rez
]
--Vincent
__________________________________________________________________
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/