cons
Loading...
Searching...
No Matches
Data Fields
cons_node Struct Reference

Structure representing a cons node. More...

#include <cons_node.h>

Collaboration diagram for cons_node:
Collaboration graph
[legend]

Data Fields

struct cons cell
 The cons cell forming the basis of the node.
 
struct conshead
 Pointer to the list of child nodes (sub-nodes).
 

Detailed Description

Structure representing a cons node.

A cons node is a specialised data structure that builds on top of cons cells. It contains a cons cell as its first member, allowing it to be treated as a cons cell when needed. The head field is a pointer to a list of child nodes (sub-nodes), which are also cons nodes. This structure allows for the construction of a tree of cons nodes, where each node can have a parent (super-node) and a list of children (sub-nodes).

Definition at line 44 of file cons_node.h.

Field Documentation

◆ cell

struct cons cons_node::cell

The cons cell forming the basis of the node.

The car field of this cell points to the parent node (super-node), while the cdr field links sibling nodes (sub-nodes) together in a list.

Note
The cell's cons structure is the first member of the node's structure, so its address matches the address of the node. This design allows for efficient access to the parent node and sibling nodes while maintaining the flexibility of a cons cell.

Definition at line 55 of file cons_node.h.

◆ head

struct cons* cons_node::head

Pointer to the list of child nodes (sub-nodes).

The head field is a pointer to a list of child nodes, which are also cons nodes.

Definition at line 62 of file cons_node.h.


The documentation for this struct was generated from the following file: