mirror of
https://github.com/HigherOrderCO/Kind.git
synced 2024-09-11 19:47:15 +03:00
18 lines
501 B
Plaintext
18 lines
501 B
Plaintext
// Creates a new node with size = 1 + (max lft.size rgt.size)
|
|
BBT.new_node
|
|
: ∀(K: *)
|
|
∀(V: *)
|
|
∀(key: K)
|
|
∀(val: V)
|
|
∀(lft: (BBT K V))
|
|
∀(rgt: (BBT K V))
|
|
(BBT K V)
|
|
= λK λV λkey λval λlft λrgt
|
|
let P = λx(BBT K V)
|
|
let new = λlft.size λlft
|
|
let P = λx(BBT K V)
|
|
let new = λrgt.size λrgt
|
|
let new_size = #(+ #1 (U60.max rgt.size lft.size))
|
|
(BBT.bin K V new_size key val lft rgt)
|
|
(~(BBT.got_size K V rgt) P new)
|
|
(~(BBT.got_size K V lft) P new) |