mirror of
https://github.com/HigherOrderCO/Kind.git
synced 2024-09-11 19:17:27 +03:00
24 lines
661 B
Plaintext
24 lines
661 B
Plaintext
// b = (left.right ~ right)
|
|
// a = (left.left ~ b)
|
|
// return a
|
|
BBT.rgt_rotate
|
|
: ∀(K: *)
|
|
∀(V: *)
|
|
∀(size: #U60)
|
|
∀(key: K)
|
|
∀(val: V)
|
|
∀(lft: (BBT K V))
|
|
∀(rgt: (BBT K V))
|
|
(BBT K V)
|
|
= λK λV λsize λkey λval λlft λrgt
|
|
let P = λx ∀(key: K) ∀(val: V) ∀(rgt: (BBT K V)) (BBT K V)
|
|
let bin = λ_size λlft.key λlft.val λlft.lft λlft.rgt
|
|
λkey λval λrgt
|
|
let b = (BBT.new_node K V key val lft.rgt rgt)
|
|
let a = (BBT.new_node K V lft.key lft.val lft.lft b )
|
|
a
|
|
let tip =
|
|
λkey λval λrgt
|
|
(BBT.bin K V size key val (BBT.tip K V) rgt)
|
|
((~lft P bin tip) key val rgt)
|