[REBOL] Re: dictionaries
From: lmecir:mbox:vol:cz at: 17-Feb-2006 18:29
Cavva napsal(a):
>Thanks Anton, your response was very useful and interesting.
>
>But, if I want to use different word defined in different context,
>i must write something like:
>
>print bind [a] ctx1
>print bind [b] ctx2
>print bind [c] ctx3
>
>Am I wrong?
>
>I think that some like
>
>using: [ 'ctx1 'ctx2 'ctx3 ]
>
>print a
>print b
>print c
>
>would be more easy
>
that is quite easy to accomplish, here is how:
using: func [
[throw]
context-block [block!]
body [block!]
] [
foreach context context-block [bind body in context 'self]
do body
]
ctx1: context [a: 11]
ctx2: context [b: 12]
ctx3: context [c: 13]
using reduce [ctx1 ctx2 ctx3] [
print a
print b
print c
]
HTH
-L