loading...

re: Function vs Object VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Functional Programming is not just made up of functions, but of pure functions. You've already started to touch on this, but these are the most imp...
 

Closures aren't pure FP.

Lambda calculus has functions with free variables. Here's the Haskell definition of a closure:

wiki.haskell.org/Closure

 

Basically, from what I've understood, a closure is still functional, but according to some purists, it's not "pure functional" because it has state.

Not that I really prioritize "purity" in terms of functional programming. Avoiding state is good for the most part, but at some point it becomes relatively impractical. Common sense required.

 

I tried to find the source for this definition (which I remembered myself, but wasn't sure where I got it from, probably from exactly this wiki). Interestingly nothing else refers open lambda term as closure. In every source that I met closures are treated as implementation detail of lambda terms🤔.

(I agree that closures are "functional", this is lambda term + environment)

Not sure what you mean, even the Wikipedia entry on closures relates them to free variables in LC:

en.m.wikipedia.org/wiki/Closure_(c...

Yes it uses free variables. My question is closure ≡ open lambda term (open lambda term - the one with free variables)? Because from implementation point of view closed lambda terms can be closures as well.

(This is just some thoughts out loud. Not questioning your comment)

Code of Conduct Report abuse