[REBOL] Re: Parse rules as data
From: brett::codeconscious::com at: 28-Jun-2001 1:05
Hi Joel,
Thanks for your reply.
The idea you think I had appears not to be the one I think I had. But you're
most welcome to pursue the former, though my interest is actually in the
latter.
The latter being as follows in example form:
author-index: context [
author-entry: [author author-rebsite]
author: [string!]
author-rebsite: [url!]
model*: [ any author-entry ]
content*: [
"Brett Handley" http://www.codeconscious.com/index.r
"Joel Neely" http://www.textimage.com/REBOL/index.r
"Allen Kamp" http://www.rebolforces.com/index.r
]
]
So I can do:
>> parse author-index/content* author-index/model*
== true
Then I'd like to provide a new model and have content "calculated" for me
doing something like:
rebsite: transform author-index rebsites-spec hints-spec
where rebsites-spec is
rebsite-spec: context [
reblink: ['folder linkurl 'info author]
author: [string!]
linkurl: [url!]
model*: [ any reblink ]
]
and hint-spec contains the magical transformation dialect that makes it all
possible :)
author-entry -> reblink
author -> author
author-rebsite -> linkurl
So for example I might end up with something like this:
rebsites: context [
reblink: ['folder linkurl 'info author]
author: [string!]
linkurl: [url!]
model*: [ any reblink ]
content*: [
folder http://www.codeconscious.com/index.r info "Brett Handley"
folder http://www.textimage.com/REBOL/index.r info "Joel Neely"
folder http://www.rebolforces.com/index.r info "Allen Kamp"
]
]
and again I can do:
>> parse rebsites/content* rebsites/model*
== true
So I guess I'm wondering if some function 'transform and some fantastic
transformation dialect will be more economical than just writing the
transformation directly in straight Rebol code.
Should I go back to dreaming?
Maybe the data generator will be more useful :)
Brett.