mirror of
https://github.com/HigherOrderCO/Bend.git
synced 2024-09-11 11:56:54 +03:00
15 lines
222 B
Plaintext
15 lines
222 B
Plaintext
add = λa λb (+ a b)
|
|
|
|
gen = λn switch n {
|
|
0: (Tree/Leaf 1)
|
|
_: (Tree/Node (gen n-1) (gen n-1))
|
|
}
|
|
|
|
sum = λt
|
|
match t {
|
|
Tree/Leaf: t.value
|
|
Tree/Node: (add (sum t.left) (sum t.right))
|
|
}
|
|
|
|
main = (sum (gen 8))
|