maca / elm-rose-tree / RoseTree.Path

The path of a RoseTree.Tree node is represented as a List Int.

This module provides functions for path manipulation.

next : List Basics.Int -> List Basics.Int

Increment last element of the path.

next [ 1, 2, 3 ] == [ 1, 2, 4 ]

parent : List Basics.Int -> List Basics.Int

Obtain the parent path.

parent [ 1, 2, 3 ] == [ 1, 2 ]

ancestor : List (List Basics.Int) -> List Basics.Int

Find a common ancestor path for a list of paths.

parent [ [ 0, 1, 0, 1 ], [ 0, 1, 1, 0 ], [ 0, 1, 2, 3 ] ] == [ 0, 1 ]