Kind/book/BBT.from_list.kind2
Victor Taelin ab98950f50 wip
2024-02-22 21:31:53 -03:00

15 lines
367 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)