From 907ade52d0703e95b2e29bd8933b1f57a3ba3e09 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Mon, 7 Oct 2024 20:44:41 -0700 Subject: Fix the B-Tree. --- map.sml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'map.sml') 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) -- cgit v1.3.1