Question: In Package `KnotTheory`, there's a function called `PD[]` that takes a tabulated knot and returns its PD codes, for example:
`PD[Knot[4, Alternating, 1]]` returns `PD[X[4, 2, 5, 1], X[6, 3, 7, 4], X[8, 6, 1, 5], X[2, 7, 3, 8]]`.

My question: what is the data type of this output above and what could be its design purpose?

Answer: 
One could agree on a following convention for describing the same knot by agreeing on what is represented in each dimension:

```
{{4, 2, 5, 1}, {6, 3, 7, 4}, {8, 6, 1, 5}, {2, 7, 3, 8}}

```

The first dimension is a list of crossings and the second dimension is a list of edges. The same [expression](https://reference.wolfram.com/language/tutorial/EverythingIsAnExpression.html) in a [`FullForm`](https://reference.wolfram.com/language/ref/FullForm.html) would be

```
List[List[4, 2, 5, 1], List[6, 3, 7, 4], List[8, 6, 1, 5], List[2, 7, 3, 8]]

```

You can make your symbolic expressions much more self-explaining, semantic and flexible by using a different [*head*](https://mathematica.stackexchange.com/questions/95513/what-is-the-definition-of-head-in-mathematica) instead of `List`:

```
PD[X[4, 2, 5, 1], X[6, 3, 7, 4], X[8, 6, 1, 5], X[2, 7, 3, 8]]

```

`PD` and `X` look like "functions" which do not do anything, but they are useful symbolic wrappers. For example, in some application you could have complex nested structures, you can easily check if the head of a function argument is correct and so on.
*Mathematica* is an expression rewriting language. "Functions" are implemented with rewriting rules. In this case, `PD` appears to be associated with a rule that rewrites `PD[Knot[...]` as `PD[X[...],...` but no rule to rewrite it further. This design pattern allows an expression to rewrite itself into a standard form. You might want to think of the `PD` in the input expression as a function (because there's a rule to rewrite it), while the `PD` in the output is more like a data type (because there's no rule to rewrite it).