Saturday, December 2, 2017

Closures, Partial functions and Currying

Closure is when a function "remembers" the variables around it even when the function is executed elsewhere.

Any language that implements lexically scoped name binding with first class functions will have closures. It can be considered as a record storing function and its environment.

Partial functions and Currying are two different techniques for specializing a generalized functions. Partial functions will take some arguments at one time and rest at other time. Currying on the other hand provides arguments one by one for specialization. Currying is kind of calling partial function automatically at each level with one argument




Further Reading

frontendmasters.com

No comments:

Post a Comment