treelist

Treelist implementation from glib (https://github.com/pendletong/glib) as a standalone module This implements an AVL tree to allow for a very fast list manipulation which performs best for larger lists where items are inserted rather than prepended

If the ability to access specific elements in a large array or removal of said elements is absolutely necessary and this needs to work in both erlang and javascript targets then this is a good option.

Package Version Hex Docs

gleam add treelist@1
import treelist

pub fn main() {
  let list = treelist.new()
  let assert Ok(new_list) = treelist.add(list, "Test")
  treelist.get(new_list, 0)
  // -> Ok("Test")
}

Further documentation can be found at https://hexdocs.pm/treelist.

Development

gleam run   # Run the project
gleam test  # Run the tests
Search Document