[REBOL] parse and datatype
From: rotenca::telvia::it at: 5-Jul-2001 0:54
At last I've found the solution for my datatype! problem. I must do:
rules: load mold rules
it was a context problem, i think, but i'm not so in deep with Rebol to
understand exactly what happens in Load.
Help speak of "converts external data" and perhaps is this the reason Bind was
not sufficient.
I think that Bind does not change the context of datatype but only of words
(?).
I'd like to have a debug routine which can explicit the context details of all
words in a block.
These errors are so difficult to catch, for me.
Perhaps Ladislav Mecir, after HighFun.r, could help?
What I do not understand is why the routine does not give the same result with
integer! or string! datatype.
Corrected routine follows.
---
ciao (my english is bad)
romano paolo tenca
---------------
REBOL[]
inb: [34]
rules: copy []
bn: 0
foreach tok inb [
mytype: type? tok
bn: bn + 1
append rules 'set
append rules to-word join form mytype bn
append rules mytype
]
rules: load mold rules ;<<<-------- the solution, but with
integer! things seems OK
print ["*** Block is:^/" mold inb]
print ["*** Rules are:^/" mold rules]
print ["*** Rules application give:^/" parse inb rules]
print "^/^/Now with decimal..."
inb: [34.1]
rules: copy []
bn: 0
foreach tok inb [
mytype: type? tok
bn: bn + 1
append rules 'set
append rules to-word join form mytype bn
append rules mytype
]
rules: load mold rules ;<<<-------- the solution
print ["*** Block is:^/" mold inb]
print ["*** Rules are:^/" mold rules]
print ["*** Rules application give:^/" parse inb rules]
halt