- Oct 2023
-
www.cl.cam.ac.uk www.cl.cam.ac.uk
-
RING STRUCTURE
Ivan writes about a concept called "Ring Structure". This is a way of organizing and linking different elements or components in a system.
In simpler terms, imagine you have a bunch of different objects (like points and lines in a drawing program like Sketchpad). You want to keep track of how these objects are related to each other. For example, you might want to know all the lines that end at a particular point.
To do this, Ivan uses a "ring structure". Each object has a "string of pointers" - basically a list of references to other objects. This list is circular - the last item in the list points back to the first item. This makes it easy to move forwards and backwards through the list.
Each object has two "registers" or slots for keeping track of these relationships. One slot is for the object itself, and the other is for the list of related objects.
Ivan uses the terms "hen" and "chicken" to describe these slots. The "hen" is the object itself, and the "chicken" is the list of related objects.
Here's a simple Python code example to illustrate this concept:
```python class Point: def init(self): self.hen = self self.chickens = []
class Line: def init(self, point1, point2): self.hen = self self.chickens = [point1, point2] point1.chickens.append(self) point2.chickens.append(self) ```
In this example, a
Point
object has ahen
that refers to itself and a list ofchickens
that will contain anyLine
objects that end at this point. When aLine
is created, it adds itself to thechickens
list of its end points.The "ring structure" is a way to organize and link different elements in a system, making it easier to find and update related elements.
-