[REBOL] Re: variable scopes and recursive func
From: tom::conlin::gmail::com at: 10-Apr-2005 21:52
I too recomend 'foreach because it seems more clear as well.
might also want to look at
either dir? aFile[... ][... ]
On Apr 10, 2005 3:09 PM, Vincent Ecuyer <[vincent_ecuyer--yahoo--com]> wrote:
> 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=E9couvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
> Cr=E9ez votre Yahoo! Mail sur http://fr.mail.yahoo.com/
> --
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
>
--
... nice weather eh