aboutsummaryrefslogtreecommitdiffstats
path: root/doc/mcgoron.weight-balanced-trees.internal.scm
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2025-01-16 23:28:26 -0500
committerGravatar Peter McGoron 2025-01-16 23:28:26 -0500
commit76907b11b323e515c839bd14c2b5c6cc51a1dc5b (patch)
tree7cc26af2539d65c494a8ec4f3dccd2a7db55ea4c /doc/mcgoron.weight-balanced-trees.internal.scm
parentsplit and search (diff)
add a generating thunk for split
Diffstat (limited to 'doc/mcgoron.weight-balanced-trees.internal.scm')
-rw-r--r--doc/mcgoron.weight-balanced-trees.internal.scm11
1 files changed, 7 insertions, 4 deletions
diff --git a/doc/mcgoron.weight-balanced-trees.internal.scm b/doc/mcgoron.weight-balanced-trees.internal.scm
index 176d18e..8baf5e7 100644
--- a/doc/mcgoron.weight-balanced-trees.internal.scm
+++ b/doc/mcgoron.weight-balanced-trees.internal.scm
@@ -52,16 +52,19 @@ with `data`."))
Returns a new tree with the elements of `left` and `right`."))
((name . "split")
- (signature lambda ((comparator? cmp) (wb-tree-node? tree) key)
- => (values wb-tree-node? boolean? wb-tree-node?))
+ (signature lambda ((comparator? cmp) (wb-tree-node? tree) key (procedure? default))
+ => (values wb-tree-node? * wb-tree-node?))
"
* It is an error if any element of `tree` is not comparable by `cmp`.
* It is an error if `key` is not comparable by `cmp`.
* It is an error if `cmp` does not have an order.
+* It is an error if `default` is not a thunk.
Returns two trees, one of all values to the left of `key`, and one with
-all values to the right of `key`. The boolean is true if the key was
-found and false otherwise.")
+all values to the right of `key`.
+
+If a value that compares equal to `key` is found, that value is returned.
+Otherwise the result of calling `default` with no arguments is returned.")
((name . "search")
(signature case-lambda ((((wb-tree-node? tree) (comparator? cmp) key) *)
(((wb-tree-node? tree) (comparator? cmp) key (procedure? default)) *)))