Tadhg has found the perfect Erlang library to help with his project. Being an older Erlang library it is using the gb_trees module rather than the newer maps module for storing data.
Help out Tadgh by creating external types and functions for working with gb_trees in Gleam.
GbTree external typeThe GbTree type should have two type parameters, a key type and a value type. It should have no constructors, making it an external type.
new_gb_tree functionThe new_gb_tree function should take no arguments and return an empty GbTree.
It should use the gb_trees:empty/0 function from the Erlang standard library.
insert functionThe insert function should take a GbTree and a key and value to insert into the tree. It should return a new GbTree with the key and value inserted.
The function should take three arguments:
GbTree to insert into.It should use the gb_trees:insert/3 function from the Erlang standard library.
delete functionThe delete function should take a GbTree and a key to delete from the tree. It should return a new GbTree with the key and value deleted.
The function should take two arguments:
GbTree to delete from.It should use the gb_trees:delete_any/2 function from the Erlang standard library.
Tadhg has found the perfect Erlang library to help with his project. Being an older Erlang library it is using the gb_trees module rather than the newer maps module for storing data.
Help out Tadgh by creating external types and functions for working with gb_trees in Gleam.
GbTree external typeThe GbTree type should have two type parameters, a key type and a value type. It should have no constructors, making it an external type.
new_gb_tree functionThe new_gb_tree function should take no arguments and return an empty GbTree.
It should use the gb_trees:empty/0 function from the Erlang standard library.
insert functionThe insert function should take a GbTree and a key and value to insert into the tree. It should return a new GbTree with the key and value inserted.
The function should take three arguments:
GbTree to insert into.It should use the gb_trees:insert/3 function from the Erlang standard library.
delete functionThe delete function should take a GbTree and a key to delete from the tree. It should return a new GbTree with the key and value deleted.
The function should take two arguments:
GbTree to delete from.It should use the gb_trees:delete_any/2 function from the Erlang standard library.