def _Lambda(self, e):
        
        _ClosureRecursion._Lambda(self, e)
        
        formals = [v.id for v in flatten(e.formals())]
        # Take the free variable list, stick it in a set to make sure we don't
        # duplicate a variable, and then put it back in a list to make sure
        # it's got a defined ordering, which sets don't have
        free = list(set([v for v in S.free_variables(e.body(), formals)
                        if v in self.env]))

        if free:
            bound = [S.Name("_K%d" % i) for i in range(len(free))]
            body = S.substituted_expression(e.body(), dict(zip(free, bound)))

            e.parameters = [body]
            e.variables = e.variables + bound

            return S.Closure([S.Name(x) for x in free], e)
        else:
            return e
dataset/ETHPy150Open bryancatanzaro/copperhead/copperhead/compiler/rewrites.py/_ClosureConverter._Lambda/original