(index ("rb-tree-map" 0))
(def (sig (procedure "rb-tree-map:: KEY-COMPARE-PROC [insdel-key-compare: KEY-COMPARE-PROC]  -> <PersistentMap>" (id rb-tree-map))) (p "where KEY-COMPARE-PROC is a user-supplied function that takes two keys and returns a negative, positive, or zero number depending on how the first key compares to the second.") (p "Optional keyword argument " (tt "insdel-key-compare") " can be used to specify different key comparison predicates for the insertion and deletion operations.") (p "The " (tt "<PersistentMap>") " typeclass contains the following operations:") (dl (dt (tt "empty")) (dd "returns a new empty tree") (dt (tt "empty? TREE")) (dd "returns " (tt "#t") " if the given tree is empty") (dt (tt "get TREE")) (dd "returns a procedure of the form " (tt "(LAMBDA KEY . DEFAULT-CLAUSE") " which searches the given tree for an association with a given " (tt "KEY") ", and returns a (key . value) pair of the found association. If an association with " (tt "KEY") " cannot be located in the  tree, the procedure returns the result of evaluating the " (tt "DEFAULT-CLAUSE") ". If the default clause is omitted, an error is signalled. " (tt "KEY") " must be comparable to the keys in the  tree by a key-compare predicate (which has been specified when the  tree was created)") (dt (tt "get-value TREE")) (dd "returns a procedure of the form " (tt "(LAMBDA KEY . DEFAULT-CLAUSE") " which searches the tree for an association with a given " (tt "KEY") ", and returns the value of (key . value) pair of the found association. If an association with " (tt "KEY") " cannot be located in the  tree, the procedure returns the result of evaluating the " (tt "DEFAULT-CLAUSE") ". If the default clause is omitted, an error is signalled. " (tt "KEY") " must be comparable to the keys in the  tree by a key-compare predicate (which has been specified when the  tree was created)") (dt (tt "get-min TREE")) (dd "returns a (key . value) pair for an association in the tree with the smallest key. If the  tree is empty, an error is signalled.") (dt (tt "get-max TREE")) (dd "returns a (key . value) pair for an association in the tree with the largest key. If the tree is empty, an error is signalled.") (dt (tt "size TREE")) (dd "returns the size (the number of associations) in the tree") (dt (tt "put TREE KEY VALUE")) (dd "returns a new  tree object that contains the given association") (dt (tt "delete TREE KEY . DEFAULT-CLAUSE")) (dd "if the specified key is found, it returns a new tree object that no longer contains the association specified by that key, while the original tree object is unmodified. If the key is not found, the procedure returns the result of evaluating " (tt "DEFAULT-CLAUSE")) (dt (tt "for-each-ascending TREE")) (dd "returns a procedure " (tt "LAMBDA PROC") " that will apply the given procedure PROC to each (key . value) association of the tree, from the one with the smallest key all the way to the one with the max key, in an ascending order of keys. ") (dt (tt "for-each-descending TREE")) (dd "returns a procedure " (tt "LAMBDA PROC") " that will apply the given procedure " (tt "PROC") "to each (key . value) association of the tree, in the descending order of keys. ") (dt (tt "map TREE")) (dd "returns a procedure " (tt "LAMBDA PROC") " that will apply the given procedure " (tt "PROC") "to the value component of each association in the  tree, in the ascending order of keys, and will construct a copy of the tree that contains the values returned by that procedure.") (dt (tt "mapi TREE")) (dd "returns a procedure " (tt "LAMBDA PROC") " that will apply the given procedure " (tt "PROC") "to each (key . value) association in the  tree, in the ascending order of keys, and will construct a copy of the tree that contains the values returned by that procedure.") (dt (tt "fold TREE")) (dd "returns a procedure " (tt "LAMBDA PROC INITIAL") " such that, given the associations in the tree ordered by the descending order of keys: " (tt "(key-n . value-n) ... (key-2 . value-2) (key-1 . value-1) ") " the procedure returns the result of the successive function applications " (tt "(PROC value-1 (PROC value-2 ... (PROC value-n INITIAL)") ". ") (dt (tt "foldi TREE")) (dd "returns a procedure " (tt "LAMBDA PROC INITIAL") " such that, given the associations in the tree ordered by the descending order of keys: " (tt "(key-n . value-n) ... (key-2 . value-2) (key-1 . value-1) ") " the procedure returns the result of the successive function applications " (tt "(PROC key-1 value-1 (PROC key-2 value-2 ... (PROC key-n value-n INITIAL)") ". ") (dt (tt "fold-right TREE")) (dd "returns a procedure " (tt "LAMBDA PROC INITIAL") " such that, given the associations in the tree ordered by the ascending order of keys: " (tt "(key-1 . value-1) (key-2 . value-2) ... (key-n . value-n) ") " the procedure returns the result of the successive function applications " (tt "(PROC value-n ... (PROC value-2 (PROC value-1 INITIAL)") ". ") (dt (tt "foldi-right TREE")) (dd "returns a procedure " (tt "LAMBDA PROC INITIAL") " such that, given the associations in the tree ordered by the ascending order of keys: " (tt "(key-1 . value-1) (key-2 . value-2) ... (key-n . value-n) ") " the procedure returns the result of the successive function applications " (tt "(PROC key-n value-n ... (PROC key-2 value-2 (PROC key-1 value-1 INITIAL)") ". ") (dt (tt "fold-partial TREE")) (dd "returns a procedure " (tt "LAMBDA PRED PROC INITIAL") " such that, given the associations in the tree ordered by the descending order of keys: " (tt "(key-n . value-n) ... (key-2 . value-2) (key-1 . value-1) ") " the procedure returns the result of the successive function applications " (tt "(PROC value-i ... (PROC value-n INITIAL)") ", where " (tt "i <= n") " and " (tt "(PRED x)") " holds true for all " (tt "x = (value-n) ... (value-i)") ". In other words, this function acts like " (tt "fold") " on the ordered subset of the values " (tt "x") " in the tree such that " (tt "(PRED x)") " is true. ") (dt (tt "foldi-partial TREE")) (dd "returns a procedure " (tt "LAMBDA PRED PROC INITIAL") " such that, given the associations in the tree ordered by the descending order of keys: " (tt "(key-n . value-n) ... (key-2 . value-2) (key-1 . value-1) ") " the procedure returns the result of the successive function applications " (tt "(PROC key-i value-i ... (PROC key-n value-n INITIAL)") ", where " (tt "i <= n") " and " (tt "(PRED xk x)") " holds true for all " (tt "x = (value-n) ... (value-i)") " and " (tt "xk = (key-n) ... (key-i)") ". In other words, this function acts like " (tt "foldi") " on the ordered subset of the key-value pairs " (tt "(k . x)") " in the tree such that " (tt "(PRED k x)") " is true. ") (dt (tt "fold-right-partial TREE")) (dd "returns a procedure " (tt "LAMBDA PRED PROC INITIAL") " such that, given the associations in the tree ordered by the ascending order of keys: " (tt "(key-1 . value-1) (key-2 . value-2) ... (key-n . value-n) ") " the procedure returns the result of the successive function applications " (tt "(PROC value-1 ... (PROC value-i INITIAL)") ", where " (tt "i <= n") " and " (tt "(PRED x)") " holds true for all " (tt "x = (value-1) ... (value-i)") ". In other words, this function acts like " (tt "fold-right") " on the ordered subset of the values " (tt "x") " in the tree such that " (tt "(PRED x)") " is true. ") (dt (tt "foldi-right-partial TREE")) (dd "returns a procedure " (tt "LAMBDA PRED PROC INITIAL") " such that, given the associations in the tree ordered by the descending order of keys: " (tt "(key-1 . value-1) (key-2 . value-2) ... (key-1 . value-1) ") " the procedure returns the result of the successive function applications " (tt "(PROC key-1 value-1 ... (PROC key-i value-i INITIAL)") ", where " (tt "i <= n") " and " (tt "(PRED xk x)") " holds true for all " (tt "x = (value-1) ... (value-i)") " and " (tt "xk = (key-1) ... (key-i)") ". In other words, this function acts like " (tt "foldi-right") " on the ordered subset of the key-value pairs " (tt "(k . x)") " in the tree such that " (tt "(PRED k x)") " is true. ") (dt (tt "fold-limit TREE")) (dd "returns a procedure " (tt "LAMBDA PRED PROC INITIAL") " such that, given the associations in the tree ordered by the descending order of keys: " (tt "(key-n . value-n) ... (key-2 . value-2) (key-1 . value-1) ") " the procedure returns the result of the successive function applications " (tt "(PROC value-i ... (PROC value-n INITIAL)") ", where " (tt "i <= n") " and " (tt "(PRED x)") " does not hold true for all " (tt "x = (PROC value-n INITIAL)  ... (PROC (value-i) (PROC value-(i-1)...") ". ") (dt (tt "fold-right-limit TREE")) (dd "returns a procedure " (tt "LAMBDA PRED PROC INITIAL") " such that, given the associations in the tree ordered by the descending order of keys: " (tt "(key-1 . value-1) (key-2 . value-2) ... (key-i . value-1) ") " the procedure returns the result of the successive function applications " (tt "(PROC value-i ... (PROC value-1 INITIAL)") ", where " (tt "i <= n") " and " (tt "(PRED x)") " does not hold true for all " (tt "x = (PROC value-1 INITIAL)  ... (PROC (value-i) (PROC value-(i-1)...") ". ")))
