module Math { public sum_(n: u64, acc: u64): u64 { let new_n: u64; let new_acc: u64; let new_sum: u64; if (copy(n) == 0) { return move(acc); } new_n = copy(n) - 1; new_acc = move(acc) + move(n); new_sum = Self.sum_(move(new_n), move(new_acc)); return move(new_sum); } public sum(n: u64): u64 { let result: u64; result = Self.sum_(move(n), 0); return move(result); } } //! new-transaction import {{default}}.Math; main() { let sum1: u64; let sum2: u64; sum1 = Math.sum(5); assert(move(sum1) == 15, 66); sum2 = Math.sum(7); assert(move(sum2) == 28, 67); return; }