maca/elm-rose-tree/1.2.1

RoseTree.Path

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

This module provides functions for path manipulation.

parent : List Int -> List Int

Obtain the parent path.

parent [ 1, 2, 3 ] == [ 1, 2 ]
ancestor : List (List Int) -> List 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 ]