Hi I want to make a tree that keeps two-way references between parent and children. But it seems impossible to achive since when I create first object I do not have the other one yet therefore cannot have a reference to it. Here is some sample code.
-record(node,{name,children,root}).
main()->
A = #node{name="node-A",
children=[B], %variable B is unbound
root=nil},
B = #node{name="node-B",
children=[],
root=A},
Tree = A.
Another example to this problem would be implementing a doubly linked list (http://en.wikipedia.org/wiki/Doubly_linked_list)
-record(node,{prev,name,next}).
main()->
A = #node{prev=nil,
name="node-A",
next=B}, % variable B is unbound
B = #node{prev=A,
name="node-B",
next=nil},
LinkedList = A.
Is there a way to implement this kind of structure.