Got it!
You’re losing constant-time lookup that way, though, as you now have to scan the map to match the first character. It’ll probably be negligible for small trees but could be more significant for trees with many character prefixes.
You might consider a structure like this:
%{
"a" => {["p", "p", "l", "e"], %{value: ...}},
"b" => {
["a", "n"],
%{
"a" => {["n", "a"], %{value: ...}},
"j" => {["o"], %{value: ...}}
}
}
}






















