[REBOL] Re: Create words dynamically
From: greggirwin::mindspring::com at: 5-Mar-2006 13:29
Welcome to REBOL!
JM> I'm pretty new to REBOL (and loving it so far), but couldn't you just coerce
JM> the strings to words using TO-WORD?
JM> foreach symbol in words [
JM> w: to-word symbol
JM> ; do something with w
>> words: [ "phhtmcl" "phhocml" ]
== ["phhtmcl" "phhocml"]
>> foreach symbol words [w: to-word symbol]
What we've done here is set the value of the word W to reference a
word! value created from the symbol, but not created new words from
** Script Error: phhocml has no value
** Near: phhocml
Given a word, it's easy to use SET to set it to an initial value. This
will create global words the way I think you expected.
>> foreach symbol words [set to-word symbol none]
Words, binding, series, and evaluation behavior aren't always obvious,
especially if you're coming from other languages, so don't be afraid
to ask questions if things don't work as expected.