def redefining_var_as_list(a): # Initialize the tape _stack = tangent.Stack() x = a tangent.push(_stack, x, 'abc') x = [a] x = tangent.pop(_stack, 'abc') return a
def stack_pushing(a): stack = tangent.Stack() y = a * a tangent.push(stack, a, 'abc') aa = tangent.pop(stack, 'abc') z = y * aa z = z * aa return z
def useless_stack_ops(a): _stack = tangent.Stack() b = a * a tangent.push(_stack, b, 'abc') b = tangent.pop(_stack, 'abc') return a
def apush(stack, val, op_id): d[val] = tangent.pop(stack, d[op_id])
def tpop(x, stack, op_id): d[x] = tangent.pop(d[stack], d[op_id])