2 ms·
You seem to be quite keen on the notion of lambda lifting a function "in place", so maybe you can explain why one would want to do that. From where I'm standin
by theoh 8y ago
You seem to be quite keen on the notion of lambda lifting a function "in place", so maybe you can explain why one would want to do that.
From where I'm standing, the lifting is about actually displacing the functions out of their current enclosing scope and into the global scope, possibly just out into an enclosing scope. But if you want to transform an anonymous function and then leave it in situ, that doesn't seem like lifting at all.
Closures explicitly don't come into the calculation, and it obviously only works in an immutable data setting (otherwise it might change the semantics of the code).
- nils-m-holm 8y ago> You seem to be quite keen on the notion of lambda lifting a function "in place", so maybe you can explain why one would want to do that. Have a look at lots of expanded LISP macros, there are nested lambdas all over the place, most of them applied in situ. Converting those applications as described above avoids the cost of closure creation and all that is left is a function call or, in case of tail application, a jump. It is a rather essential optimization in LISP. Also: in situ application is useful for illustrating the principle. I have described the more general case somewhere else in this discussion.