Thanks, Larry! You're absolutely right...
I ran into this a while back in the context of the following kind of
thing:
something: [print x]
foreach x some-block [do something]
but the knowledge hasn't made it from my memory to my typing fingers! ;-)
-jn-
[EMAIL PROTECTED] wrote:
>
> Hi Joel
>
> Just a small clarification. You wrote:
>
> >> searchname: func [who [string!] /local k v] [
> [ foreach [k v] foo [
> [ if v/name = who [return v]
> [ ]
> [ ]
>
> Actually the declaration of k and v as local vars to the searchname function
> is unnecessary as in your example they are never used. The foreach function
> binds the words in it's first arg (also k and v in your example) as local to
> it's own context. The outer k and v are unused. Here is a short example:
>
> >> f: func [/local k][
> [ k: 1
> [ foreach [k]["a" "b"][print k]
> [ print k
> [ ]
> >> f
> a
> b
> 1
> >>
>
> Cheers
> -Larry
--
; Joel Neely [EMAIL PROTECTED] 901-263-4460 38017/HKA/9677
REBOL [] print to-string debase decompress #{
789C0BCE0BAB4A7176CA48CAB53448740FABF474F3720BCC
B6F4F574CFC888342AC949CE74B50500E1710C0C24000000}