Hacker News new | past | comments | ask | show | jobs | submit login

Also anonymous functions in programming languages didn't historically always or even usually have lexical scope (= be closures).

Eg Lisp had lambda expressions for a long time (20 years? 30 years?) before lexical scoping made it in. Python also had its lambda and nested functions for a long time before lexical scopes came to the language. The namesake, lambda calculus, doesn't have it (I think?).




> The namesake, lambda calculus, doesn't have it (I think?).

Lambdas in the Lambda Calculus have to be closures, how else would you build functions of multiple arguments? Think:

  λx.λy.(x + y)
If they weren't closures, `x` would be unbound in the inner lambda.


Ah, right. And apparently this was a prime motivation to for the first Lispy closures implementation, which was called... Scheme. https://en.wikisource.org/wiki/Scheme:_An_Interpreter_for_Ex...

"we have implemented an interpreter for a LISP-like language, SCHEME, based on the lambda calculus [Church]"




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: