def ref(t): if isvar(t): newt = l + t vs.add(newt) return newt elif not istuple(t): return t else: return tuple(map(ref, t))
def relocate(t): if isvar(t): newt = vtop + t if newt >= len(vs): extendTo(newt, vs) return newt elif not istuple(t): return t else: return tuple(map(relocate, t))