Skip to content

View

MutableSequenceView dataclass

MutableSequenceView(node: NodeType, field: FieldType)

Bases: SequenceView[FieldType, NodeType, ElemType]


              flowchart TD
              kirin.ir.nodes.view.MutableSequenceView[MutableSequenceView]
              kirin.ir.nodes.view.SequenceView[SequenceView]
              kirin.ir.nodes.view.View[View]

                              kirin.ir.nodes.view.SequenceView --> kirin.ir.nodes.view.MutableSequenceView
                                kirin.ir.nodes.view.View --> kirin.ir.nodes.view.SequenceView
                



              click kirin.ir.nodes.view.MutableSequenceView href "" "kirin.ir.nodes.view.MutableSequenceView"
              click kirin.ir.nodes.view.SequenceView href "" "kirin.ir.nodes.view.SequenceView"
              click kirin.ir.nodes.view.View href "" "kirin.ir.nodes.view.View"
            

popfirst

popfirst() -> ElemType | None

Pop the first element from the view.

Returns:

Type Description
ElemType | None

The first element in the view.

Source code in src/kirin/ir/nodes/view.py
134
135
136
137
138
139
140
141
142
def popfirst(self) -> ElemType | None:
    """Pop the first element from the view.

    Returns:
        The first element in the view.
    """
    if self:
        return self.pop(0)
    return None

poplast

poplast() -> ElemType | None

Pop the last element from the view.

Returns:

Type Description
ElemType | None

The last element in the view.

Source code in src/kirin/ir/nodes/view.py
124
125
126
127
128
129
130
131
132
def poplast(self) -> ElemType | None:
    """Pop the last element from the view.

    Returns:
        The last element in the view.
    """
    if self:
        return self.pop(-1)
    return None