PROLOG 2-3-TREE PACKAGE Contributed by Mark Johnson Shelved on the 16th of October 1992 The procedures in this file manipulate finite maps from keys to values. Because 2-3 trees are used, they automatically rebalance after each insertion or deletion. The entry contains two files: TREE23.PRE - this file TREE23.PL - the source. To use the code, consult TREE23.PL and call any of the predicates specified at the start of the file. Example: ?- list_to_23( [ cat-dog, hare-rabbit, "hair"-"fur", king-queen, exp(1)-2.71828, 3.141593-pi ], Tree ), portray_23( Tree ), put_23( 39, Tree, steps, Tree1 ), portray_23( Tree1 ). gives 23 Tree{ 3.141593 - pi cat - dog hare - rabbit king - queen exp(1) - 2.71828 [104, 97, 105, 114] - [102, 117, 114] } 23 Tree{ 3.141593 - pi 39 - steps cat - dog hare - rabbit king - queen exp(1) - 2.71828 [104, 97, 105, 114] - [102, 117, 114] } CHECKED ON EDINBURGH-COMPATIBLE (POPLOG) PROLOG : yes. PORTABILITY : uses % comments; assumes compare/3 for comparing arbitrary terms. The source file compare_terms.pl in my source for the Logic Programming Tutor provides this. INTERNAL DOCUMENTATION : brief specification of public and private predicates.