rust/src/test/bench/shootout/binary-trees.rs

18 lines
250 B
Rust
Raw Normal View History

tag tree {
nil;
node(@tree, @tree, int);
}
2010-06-23 23:03:09 -05:00
fn item_check(@tree t) -> int {
alt (*t) {
case (nil) {
2010-06-23 23:03:09 -05:00
ret 0;
}
case (node(?left, ?right, ?item)) {
2010-06-23 23:03:09 -05:00
ret item + item_check(left) - item_check(right);
}
}
}
fn main() {
}