Hi list,
and the winner is (my preferred one that is) :
> >> name: 250
> == 250
> >> string: "name"
> == "name"
> >> get to word! string
> == 250
>
> No need for IN, converting to word already binds to the global
> context.
Interesting and useful info for me since I recently looked at 'bind and the
question remaining unanswered to me was how to bind a
variable defined in a local context to some word defined in the global context.
Thanks you Gabriele and every others that also have submitted helpful
solutions. I'll look at them later in an effort to compare
their respective value and learn more about REBOL.
Regards,
Gerard
P.S. If you asked yourself what was the usefulness of all this let me simply
say that I am working on a REBOL version of a printf
work alike. Many languages offer this instruction: C, awk, ...
The proposed syntax will be something like :
printf ["%-d| %|6.2f| %08b %-6s" n 123 123 "allo"] "%"
the last part is a delimiter and will be suppressed during the final stage.
If you look in detail at the different parts her is a summary for all of them:
a beginning field delimiter %
an optional | char (used for vertical alignment
during printout if desired)
an optional alignment flag can be - + " " 0 c (left aligned
for minus, add sign for plus,
left padding with blanks or zeros, field
centering for c)
an optional field width (number)
an optional precision (dot followed by number)
a conversion code (specifies conversion type from the
original data to its final form,
present supported forms
are b-binary, o-octal, h-hex, d/f-decimal,
e/g-scientific form and
s-string)
a final optional | char (used for vertical alignment
during printout if desired)
Some details have yet to be done before the printf is completed. I'll announce
it for posting to the library for study when ready to
release if there is some interest. Also welcomed is any suggestion to enhance
the usability of the actual printf, which I really
never found user friendly at all.
--
To unsubscribe from the list, just send an email to
lists at rebol.com with unsubscribe as the subject.