Kind/book/BBT.from_list.kind2
2024-03-01 20:40:31 -03:00

15 lines
368 B
Plaintext

BBT.from_list
: ∀(K: *)
∀(V: *)
∀(cmp: ∀(a: K) ∀(b: K) Cmp)
∀(list: (List (Pair K V)))
(BBT K V)
= λK λV λcmp λlist
let P = λx (BBT K V)
let cons = λhead λtail
let P = λx (BBT K V)
let new = λkey λval
(BBT.set K V cmp key val (BBT.from_list K V cmp tail))
(~head P new)
let nil = (BBT.tip K V)
(~list P cons nil)