[REBOL] Re: Generating words and global variable space
From: dankelg8:cs:man:ac at: 22-Mar-2001 15:58
On Thu, 22 Mar 2001, Vos, Doug wrote:
> Why do you want to generate all the new words?
> Why not use blocks or objects?
>
> I have thousands of lines of rebol script and
> rarely use more than 3 or 4 global words per script.
>
> I mostly use local words and global objects.
>
> Can you explain more what you are trying to do?
> Then I'm sure people will be able to help...
OK. :)
First, as Michael pointed out, it doesn't matter where you define a word,
it will be added to System/words when it is first encountered by Rebol.
I'm writing a simple Prolog interpreter where the format of the rules are
like this:
[[father 'Bill 'Bob]]
[[mother 'Ann 'Bob]]
[[parent x y] [father x y]]
[[parent x y] [mother x y]]
[[grandparent x y] [parent x z] [parent z y]]
And so on.
Variables must be renamed before unification to aviod name clashes.
For example, [[parent x y] [father x y]] could become
[[parent _x20 _y15] [father _x20 _y15]]
In deep search trees, I quickly run out of variables.
There are ways to solve it, but it would make the algorithm slower.
Since it's not enormously efficient at the moment, I thought I'd check if
there were any other way.
Gisle