Last active
September 14, 2015 07:38
-
-
Save codepreneur/087cf4fd10eefdae1784 to your computer and use it in GitHub Desktop.
Revisions
-
ericelliott revised this gist
May 19, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -46,7 +46,7 @@ `) })(); $('#el').on('click', function clickHandler () { console.log(` This is an example of a lambda expression that is not anonymous. As you can see, it clearly has a name, clickHandler, which can be used inside the -
ericelliott revised this gist
Apr 19, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ // Anonymous function means "function without a name". // This is one of the relatively few cases where the Wikipedia definition of // a word, while not entirely wrong, is misleading. Lambdas and anonymous // functions are distinct ideas. // These ideas are commonly confused because in many programming languages -
ericelliott revised this gist
Apr 19, 2015 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,6 +8,9 @@ // These ideas are commonly confused because in many programming languages // all lambdas are anonymous or vise verse. // In JavaScript, not all lambdas are anonymous, and not all anonymous // functions are lambdas, so the distinction has some practical meaning. (function () { console.log(` Some people mistakenly think that "lambda" and "anonymous function" have -
ericelliott revised this gist
Apr 19, 2015 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,9 @@ // a word, while not entirely wrong, is misleading. Lambdas and Anonymous // functions are distinct ideas. // These ideas are commonly confused because in many programming languages // all lambdas are anonymous or vise verse. (function () { console.log(` Some people mistakenly think that "lambda" and "anonymous function" have -
ericelliott revised this gist
Apr 19, 2015 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,9 @@ // TL;DR - Lambda means "function used as data". // Anonymous function means "function without a name". // This is one of the relatively few cases where the Wikipedia definition of // a word, while not entirely wrong, is misleading. Lambdas and Anonymous // functions are distinct ideas. (function () { console.log(` -
ericelliott revised this gist
Apr 19, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ // Anonymous function means "function without a name". // One of the relatively few cases where the Wikipedia definition of a word, // while not entirely wrong, is misleading. Lambdas and Anonymous functions // are distinct ideas. (function () { -
ericelliott revised this gist
Apr 19, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ // TL;DR - Lambda means "function used as data". // Anonymous function means "function without a name". // One of the relatively few cases where the Wikipedia definition of a word, // while not entirely wrong is misleading. Lambdas and Anonymous functions -
ericelliott revised this gist
Apr 19, 2015 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,6 @@ // TL;DR - Lambda means "function used as data." // Anonymous function means "function without a name." // One of the relatively few cases where the Wikipedia definition of a word, // while not entirely wrong is misleading. Lambdas and Anonymous functions // are distinct ideas. -
ericelliott revised this gist
Apr 19, 2015 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,7 @@ // One of the relatively few cases where the Wikipedia definition of a word, // while not entirely wrong is misleading. Lambdas and Anonymous functions // are distinct ideas. (function () { console.log(` Some people mistakenly think that "lambda" and "anonymous function" have -
ericelliott created this gist
Apr 18, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ (function () { console.log(` Some people mistakenly think that "lambda" and "anonymous function" have the same meaning. Let's clear that up. In computer science, the most important, defining characteristic of a lambda expression is that it is used as data. That is, the function is passed as an argument to another function, returned as a value from a function, or assigned to variables or data structures. This is basically the definition of a first class function. In JavaScript, you can use any function as a lambda expression because functions are first class. However, that does not mean that all JavaScript functions are therefore lambda expressions. For instance, this expression defines a function which gets immediately invoked and then dropped on the floor rather than passed, exported, or assigned. In other words, the function is not used as data. Instead, it's used for a side-effect (logging this text to the console). Conceptually, this is more akin to imperative programming than functional programming, and thinking of this function as a lambda would add zero useful meaning to your understanding of it. This distinction is not essential, but is a useful concept when you're learning functional programming. In other words, if you understand this distinction, you have a deeper understanding of what the word "lambda" means in both functional programming and lambda calculus (which are closely related). It is possible to use functional language features like first-class functions in an imperative style, but that adds nothing interesting to your grasp of the language, or your grasp of why lambda expressions exist in the first place. `) })(); $('#el').on(click, function clickHandler () { console.log(` This is an example of a lambda expression that is not anonymous. As you can see, it clearly has a name, clickHandler, which can be used inside the function for the purpose of recursion (also an important concept in functional programming). It is a lambda expression because of the semantic use -- it's being passed to another function as data. The .on() function is using the function as an argument -- in other words, communicated as a message (i.e. functions as data). `); });