There is a more fully worked out example in <https://github.com/c-blake/cligen/blob/master/cligen/trie.nim> \-- the core idea is over by line 63.
I may soon be lifting the [ternary search tree](https://en.wikipedia.org/wiki/Ternary_search_tree), that unordered trie, and that which uses both, the automatic glob-abbreviation system, into their own package. Also note that since I use `seq[ref NodeOb[T]]` instead of `array[AlphaSize, ..]` the "memory indirection depth" is 2X larger to get space savings that is, well, dependent upon the memory allocator in use. Using less space for all those alphabet pointers is a cottage industry of digital search tree optimization.