I'm trying to build a simply binary tree (made of node structs which each have two "child" slots and one "parent" slot)

(defstruct node child-a child-b parent)

I can for example create two new nodes like so:(defparameter a (make-node))(defparameter b (make-node))

Now I want to create their parent like so:(defparameter c (make-node :child-a a :child-b b))

Fine, good so far.Now I need to let the children nodes (a and b) link back to their parent c. (so the binary tree can be traversed in 2 directions)HOWEVER I get an immediate error when trying to set the parent value for a and b:(setf (node-parent a) c)

DEFSTRUCT is too simple-minded to handle inheritance properly, you would need to write some extra functions to keep track of all possible inheritance issues. In Paul Graham's ANSI Common Lisp are some examples how this would work.

(setf (node-parent a) c) creates an infinite loop because a already contains a reference to c, where a, b, c are instances of one and the the same STRUCTURE-CLASS, so CLOS can't resolve the precedence properly.