mirror of
https://github.com/HigherOrderCO/Kind.git
synced 2024-09-11 20:47:25 +03:00
17 lines
443 B
Plaintext
17 lines
443 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) |