mirror of
https://github.com/HigherOrderCO/Kind.git
synced 2024-09-11 19:47:15 +03:00
16 lines
416 B
Plaintext
16 lines
416 B
Plaintext
BBT.to_list
|
|
: ∀(K: *)
|
|
∀(V: *)
|
|
∀(map: (BBT K V))
|
|
(List (Pair K V))
|
|
= λK λV λmap
|
|
let P = λx(List (Pair K V))
|
|
let bin = λsize λkey λval λlft λrgt
|
|
let lft = (BBT.to_list K V lft)
|
|
let rgt = (BBT.to_list K V rgt)
|
|
let pair = (Pair.new K V key val)
|
|
let list = (List.cons (Pair K V) pair (List.concat (Pair K V) lft rgt))
|
|
list
|
|
let tip = (List.nil (Pair K V))
|
|
(~map P bin tip)
|