TernaryMap: A prefix-tree map implementation

Finally finished writing a bunch of tests for coverage, plus I wanted to have sub-key iterators. Let me know what you think.
consider renaming `fun` to something more descriptive, like `predicate`