-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Added Closures #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Closures #116
Conversation
readme.md
Outdated
@@ -145,6 +146,34 @@ add2(10) // 12 | |||
|
|||
``` | |||
|
|||
##Closure | |||
|
|||
A very simplistic definition - A closure is a way of accessing a variable outside its scope. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the definitions are supposed to be simple so this goes without saying
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heh heh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haah. Cool, will take that off.
Closures are requirement for Currying. |
Hi, @jethrolarson @hemanth - any more comments or changes? This is hanging since 3 weeks now 😆 |
I think it would also be useful to add the difference between closures and lamdas (a lot of ppl seem to not know the difference between them) |
readme.md
Outdated
|
||
|
||
```js | ||
var addTo = function(x) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const addTo = x => y => x + y;
Would vote for that! |
Ping! |
Added closure vs lambda as suggested.
Couldn't finish this for a long time, sorry! |
Thanks! |
## Closure | ||
|
||
A closure is a way of accessing a variable outside its scope. | ||
Formally, a closure is a technique for implementing lexically scopped named binding. It is a way of storing a function with an environment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/scopped/scoped/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#149 !
Tx! |
Placing this after Currying because I feel they are related and often confused with each other.