Algae v1.1.0 Algae.Tree.Rose View Source

A tree with any number of nodes at each level

Examples

%Algae.Tree.Rose{
  rose: 42,
  forrest: [
    %Algae.Tree.Rose{
      rose: "hi"
    },
    %Algae.Tree.Rose{
      forrest: [
        %Algae.Tree.Rose{
          rose: 0.4
        }
      ]
    },
    %Algae.Tree.Rose{
      rose: "there"
    }
  ]
}

Link to this section Summary

Functions

Wrap another tree around an existing one, relegating it to the forrest

Create a simple Algae.Rose tree, with an empty forrest and one rose

Create an Algae.Rose tree, passing a forrest and a rose

Link to this section Types

Link to this type forrest() View Source
forrest() :: [t]
Link to this type t() View Source
t() :: %Algae.Tree.Rose{forrest: [t], rose: any}

Link to this section Functions

Link to this function layer(tree, rose) View Source
layer(t, rose) :: t

Wrap another tree around an existing one, relegating it to the forrest.

Examples

iex> 55
...> |> new()
...> |> layer(42)
...> |> layer(99)
...> |> layer(6)
%Algae.Tree.Rose{
  rose: 6,
  forrest: [
    %Algae.Tree.Rose{
      rose: 99,
      forrest: [
        %Algae.Tree.Rose{
          rose: 42,
          forrest: [
            %Algae.Tree.Rose{
              rose: 55
            }
          ]
        }
      ]
    }
  ]
}

Create a simple Algae.Rose tree, with an empty forrest and one rose.

Examples

iex> new(42)
%Algae.Tree.Rose{
  rose: 42,
  forrest: []
}
Link to this function new(rose \\ nil, forrest \\ []) View Source
new(any, [t]) :: t
new(rose, forrest) :: t

Create an Algae.Rose tree, passing a forrest and a rose.

Examples

iex> new(42, [new(55), new(14)])
%Algae.Tree.Rose{
  rose: 42,
  forrest: [
    %Algae.Tree.Rose{rose: 55},
    %Algae.Tree.Rose{rose: 14}
  ]
}