Method code for $trie.to_dict()

[Turn off line numbering]
  1: arg trie, @prefix;
  2: var n, i, dict;
  3: 
  4: // This function will only convert single-valued tries (such as were
  5: // probably obtained from dictionaries
  6: [(prefix ?= "")] = prefix;
  7: dict = trie[1] ? #[[prefix + trie[1][1], trie[1][2]]] : #[];
  8: if (trie[2]) {
  9:     for i in [1 .. trie[2].length()]
 10:         dict = dict_union(dict, .to_dict(trie[2 + i], prefix + trie[2][i]));
 11:     refresh();
 12: }
 13: return dict;

// Miroslav Silovic
// Created 10-May-1995 as a part of ColdCore, see: @help Credit

Tlon