[REBOL] Re: the utility of 'bind
From: maximo:meteorstudios at: 21-Jan-2004 16:33
> --- Tim Johnson wrote: ---
> ; untested code!
> context.....[
> validate: func[args[block!] /local keywords][
> keywords: self/__dict__
> foreach [arg value] args[
> if not find keywords arg[
> throw-an-error
> ]
> ]
> ]
> ]
another way to code the above (but this also support validating just one word):
context [
validate: func [word [block! word!] /local item][
either block! = type? word [
foreach item word [
if not (validate item) [return false]
]
return true
][
either found? in self word [true][false]
]
]
]
IMHO, I find this version a little bit more readable.
tim, this is not a challenge to your coding skills... I just like to show different views
of a problem, for academic purposes.... this helps novices a lot.
-Max