def test_tagged_more(c, x, y, z): if c == 0: return tagged(x) elif c > 0: return tagged(y) else: return tagged(z)
def countdown(n): if n == 0: return tagged(None) else: return tagged( Pair( n, countdown(n - 1) ) )
def make_tree(depth, x): if depth == 0: return tagged(x) else: return tagged( Pair( make_tree(depth - 1, x * 2), make_tree(depth - 1, x * 2 + 1) ) )
def test_tagged_too_many_arguments(x): return tagged(x, 1, 2)
def test_tagged(x, y, z): if x > 0: return tagged(y) else: return tagged(z)