A functional key,value store that works on anything.

This works using a binary search tree. In the first version, it's a very naive algorithm, but it will probably be updated to be a red-black tree or something else.

This is copied and modified from treemap right now. It's missing a lot of features.

Type treemap

type treemap<K, V> = @tree_node<K, V>

Function find

fn find<K, V: copy>(m: treemap<K, V>, k: K) -> option<V>

Find a value based on the key

Function init

fn init<K, V>() -> treemap<K, V>

Create a treemap

Function insert

fn insert<K: copy, V: copy>(m: treemap<K, V>, k: K, v: V) -> treemap<K, V>

Insert a value into the map

Function traverse

fn traverse<K, V: copy>(m: treemap<K, V>, f: fn(K, V))

Visit all pairs in the map in order.