This repository has been archived on 2024-01-18. You can view files and clone it, but cannot push or open issues or pull requests.
compilation/flap/tests/02-Interpreter/70-tree.eval.hopix.human-readable

14 lines
319 B
Text
Raw Permalink Normal View History

2023-10-25 15:16:53 +02:00
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")
}