Skip to content

Use StaticArray for children #86

Open
@MilesCranmer

Description

@MilesCranmer

I think the generalization to more than 2 children would be best attempted with StaticArrays.MArray. So you could have a field

struct Node{T,N}
    degree::UInt8
    ...
    _children::MVector{Node{T,N},N}
end

The beauty of this is you could still have undefined values (https://discourse.julialang.org/t/how-to-initialize-an-empty-staticarray/69942/11?u=milescranmer) and the max number of children would still be a compile time constant.

And calling children(node) could return a Vector according to the degree of the node. (Though we would still want to have special methods for each degree).

Similarly, for OperatorEnum, it could be a tuple of tuples up to the maximum arity.

@gca30 interested to hear your thoughts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions