mirror of
https://github.com/HigherOrderCO/Kind.git
synced 2024-09-11 17:56:48 +03:00
15 lines
367 B
Plaintext
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)
|