summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2024-10-07 20:44:41 -0700
committerRose Hogenson <rosehogenson@posteo.net>2024-10-07 20:44:41 -0700
commit907ade52d0703e95b2e29bd8933b1f57a3ba3e09 (patch)
treed926eb37b5cddc7bfeff080f619cf30f3f0910ec
parentbe6f83561633666d64253a9fa541f1adcd442da0 (diff)
downloadsml-907ade52d0703e95b2e29bd8933b1f57a3ba3e09.tar.zst
Fix the B-Tree.
-rw-r--r--map.sml4
1 files changed, 2 insertions, 2 deletions
diff --git a/map.sml b/map.sml
index 7e05785..d8b3a37 100644
--- a/map.sml
+++ b/map.sml
@@ -38,11 +38,11 @@ struct
fun two (l : 'a map) (k : key) (v : 'a) (r : 'a map) : 'a map =
if height l <> height r then raise Fail "two: height mismatch" else
- Two (height l, l, k, v, r)
+ Two (height l + 1, l, k, v, r)
fun three (a : 'a map) (k1 : key) (v1 : 'a) (b : 'a map) (k2 : key) (v2 : 'a) (c : 'a map) : 'a map =
if not (height a = height b andalso height b = height c) then raise Fail "three: height mismatch" else
- Three (height a, a, k1, v1, b, k2, v2, c)
+ Three (height a + 1, a, k1, v1, b, k2, v2, c)
fun view (Tip : 'a map) : ('a map * key * 'a * 'a map) option = NONE
| view (Two (_, l, k, v, r)) = SOME (l, k, v, r)