14 lines
319 B
Text
14 lines
319 B
Text
|
fun make (n) =
|
||
|
if (n =? 0) then { Leaf } else { Node (make (n - 1), make (n - 1)) }
|
||
|
|
||
|
fun count (accu, t) =
|
||
|
match (t) {
|
||
|
| Leaf -> 1 + accu
|
||
|
| Node (l, r) -> count (count (accu, l), r)
|
||
|
}
|
||
|
|
||
|
let test =
|
||
|
for i from (0) to (14) {
|
||
|
print_int (count (0, make (i)));
|
||
|
print_string ("\n")
|
||
|
}
|