~artoj/hare-avltree

AVL tree implementation for Hare (WIP)
first implementation of iterators
rewrite `rebalance` to be more idiomatic
directly use return in match

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~artoj/hare-avltree
read/write
git@git.sr.ht:~artoj/hare-avltree

You can also use your local clone with git send-email.

#hare-avltree

AVL tree implementation for Hare (WIP).

#Usage

use avltree;
use fmt;
use sort::cmp;

export fn main() void = {
	let tree = avltree::init(&cmp::ints, null);
	defer avltree::finish(&tree);

	avltree::ins(&tree, &1);
	avltree::ins(&tree, &0);
	avltree::ins(&tree, &2);

	match (avltree::search(&tree, &2)) {
	case void =>
	    fmt::println("unable to find value '2'")!;
	case let node: *avltree::avlnode =>
	    fmt::println("found node with value '2'")!;
	};
};

#Installation

#System-wide installation

# make install

#Library usage

The package provides avltree Hare module. See haredoc for usage details.

#Contributing

Please send patches to ~artoj/public-inbox@lists.sr.ht using git send-email with prefix set to hare-avltree:

$ git config format.subjectPrefix "PATCH hare-avltree"