diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2024-10-07 20:44:41 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2024-10-07 20:44:41 -0700 |
| commit | 907ade52d0703e95b2e29bd8933b1f57a3ba3e09 (patch) | |
| tree | d926eb37b5cddc7bfeff080f619cf30f3f0910ec /map.sml | |
| parent | be6f83561633666d64253a9fa541f1adcd442da0 (diff) | |
| download | sml-907ade52d0703e95b2e29bd8933b1f57a3ba3e09.tar.zst | |
Fix the B-Tree.
Diffstat (limited to 'map.sml')
| -rw-r--r-- | map.sml | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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) |
