{ x_trace:3 => 0; set:(debug_mode, false:()) => 0; ! BTree.Insert:(newKey) [2] = { if:(.debug_mode, f_put:((), "=> ", newKey, " ")); set:(cmp, apply:(BTree.Sorter, newKey, BTree.Key)); if:(lt:(cmp, 0), if:(BTree.Left, with:(BTree.Left, BTree.Insert:newKey), set:(BTree.Left, .BTree:(newKey, BTree.Sorter))), if:(gt:(cmp, 0), if:(BTree.Right, with:(BTree.Right, BTree.Insert:newKey), set:(BTree.Right, .BTree:(newKey, BTree.Sorter))), inc:BTree.Count)); } => BTree.Insert:; ! BTree.Apply_Sorted:(do_with_key) [2] = { set:(Summary, BTree.Count); if:(BTree.Left, comb:add:(Summary, with:(BTree.Left, BTree.Apply_Sorted:do_with_key))); apply:(do_with_key, BTree.Key, BTree.Count); if:(BTree.Right, comb:add:(Summary, with:(BTree.Right, BTree.Apply_Sorted:do_with_key))); Summary } => BTree.Apply_Sorted:; !! BTree:(Key Sorter) {5} = set:(Count, 1) ~ () => BTree:; set:(tree, BTree:(0, ! (X Y) [2] = cmp:(X, Y))) => BTree:{0, ! (X Y) [2] = cmp:(X, Y), (), (), 1}; with:(tree, { for_dec:(i, (0, 20), BTree.Insert:div:(sub:(i, 4), 8)); for_inc:(i, (neg:10, 10), BTree.Insert:mul:(i, 2.3)); for_dec:(i, (neg:15, 15), BTree.Insert:div:(i, 5)); for_inc:(i, (neg:5, 5), BTree.Insert:div:(mul:(i, 6), 4)); }) => (); [-23.] #1 [-20.7] #1 [-18.4] #1 [-16.1] #1 [-13.8] #1 [-11.5] #1 [-9.2] #1 [-7.5] #1 [-6.9] #1 [-6.] #1 [-4.6] #1 [-4.5] #1 [-3.] #2 [-2.8] #1 [-2.6] #1 [-2.4] #1 [-2.3] #1 [-2.2] #1 [-2.] #1 [-1.8] #1 [-1.6] #1 [-1.5] #1 [-1.4] #1 [-1.2] #1 [-1.] #1 [-0.8] #1 [-0.6] #1 [-0.5] #1 [-0.4] #1 [-0.375] #1 [-0.25] #1 [-0.2] #1 [-0.125] #1 [0] #5 [0.125] #1 [0.2] #1 [0.25] #1 [0.375] #1 [0.4] #1 [0.5] #1 [0.6] #1 [0.625] #1 [0.75] #1 [0.8] #1 [0.875] #1 [1.] #2 [1.125] #1 [1.2] #1 [1.25] #1 [1.375] #1 [1.4] #1 [1.5] #2 [1.6] #1 [1.625] #1 [1.75] #1 [1.8] #1 [1.875] #1 [2.] #1 [2.2] #1 [2.3] #1 [2.4] #1 [2.6] #1 [2.8] #1 [3.] #1 [4.5] #1 [4.6] #1 [6.] #1 [6.9] #1 [9.2] #1 [11.5] #1 [13.8] #1 [16.1] #1 [18.4] #1 [20.7] #1 --- Total #: 81 { f_put:((), " "); set:(Total, with:(tree, BTree.Apply_Sorted:! (Key Count) [2] = f_put:((), "[", Key, "] #", Count, " "))); f_put:((), "--- Total #: ", Total, " "); } => (); set:(a_tree, BTree:("", ! (S T) [2] = s_cmp:(S, T))) => BTree:{"", ! (S T) [2] = s_cmp:(S, T), (), (), 1}; set:(str_list, "a", "abb", "aab", "acc", "aacc", "abc") => ("a", "abb", "aab", "acc", "aacc", "abc"); with:(a_tree, l_loop:(ss, str_list, l_loop:(tt, str_list, { BTree.Insert:s_cat:(ss, tt); BTree.Insert:s_cat:(tt, ss); }))) => (); [] #1 [aa] #2 [aaab] #2 [aaacc] #2 [aaba] #2 [aabaab] #2 [aabaacc] #2 [aababb] #2 [aababc] #2 [aabacc] #2 [aabb] #2 [aabc] #2 [aacc] #2 [aacca] #2 [aaccaab] #2 [aaccaacc] #2 [aaccabb] #2 [aaccabc] #2 [aaccacc] #2 [abba] #2 [abbaab] #2 [abbaacc] #2 [abbabb] #2 [abbabc] #2 [abbacc] #2 [abca] #2 [abcaab] #2 [abcaacc] #2 [abcabb] #2 [abcabc] #2 [abcacc] #2 [acca] #2 [accaab] #2 [accaacc] #2 [accabb] #2 [accabc] #2 [accacc] #2 --- Total #: 73 f_put:({ f_put:((), " "); set:(Total, with:(a_tree, BTree.Apply_Sorted:! (Key Count) [2] = f_put:((), "[", Key, "] #", Count, " "))); f_put:((), "--- Total #: ", Total, " "); }, " ") => 1; } #90 / [12]