Thanks Sterling:
        I will follow this proces that you have
laid out.
BTW:
This is the first step in a full-blown DBMS in
rebol. I will first attempt to clone the Mix C/Database
Toolchest - (written in C), and then to optimize
based on rebol's best features. 
Take care
-Tim
At 01:36 PM 7/3/00 -0700, you wrote:
>
>Well, as you know, you get doubly linked lists for free in REBOL.
>That's called a block.  To do the other part, I'd just make the items
>in your block another block or an object.  Then hold an index in one
>of the vars in that.
>
>triple: copy [] ; the linked list
>foreach item [[none 42] [4 9700] [1 15] [3 1846]] [
>       repend triple item
>]
>
>now there are four items in triple.  Each item is a block where the
>first number is what you call *mrk in your structure and the second
>number is the num you have in your struct.  The marker is an index
>back into triple so that you can do 'pick triple triple/2/1' and that
>will bring back the block indexed by the third link of the second item 
>in triple, namely item number four "[3 1846]".
>
>Another thing you could do is put an actual reference to triple into 
>the block:
>repend triple [skip triple 3 675]
>
>This way the first item in the block is actually a refernce into the
>triple block.
>
>You could do this with objects as well instead of blocks but I'll
>leave that excercise to the reader.  The implementation you choose
>should be the one best suited for your application.  Take into account
>all the uses of that third link, how much data you want to store in
>this item, and how you will be manipulating it.
>
>Sterling
>
>> Hello:
>>      I'd like to implement a *triple* linked list in rebol.
>> Below is a "c" structure: I'd welcome advice on how
>> to translate this to a rebol data structure.
>> If I'm correct, the nxt and prv elements are encapsulated
>> by a rebol list. What I'd like to figure out is how to
>> manually reference another node in the list.
>> (the mrk element)
>> 
>>   typedef struct test_node
>>   {
>>     struct test_node *nxt; // points to next node
>>     struct test_node *prv; // points to previous node
>>     struct test_node *mrk; // points to a randomly selected node
>>     long num;
>>   }TestNode;
>> 
>> Thanks In Advance
>> Regards
>> -Tim
>> 
>> 
>
>

Reply via email to