Skip to content

Instantly share code, notes, and snippets.

@lukehinds
Created June 9, 2016 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukehinds/63d9cb5ac2656e613f54ff74ff913706 to your computer and use it in GitHub Desktop.
Save lukehinds/63d9cb5ac2656e613f54ff74ff913706 to your computer and use it in GitHub Desktop.
lambda is just a fancy way of saying function. Other than its name, there is nothing obscure, intimidating or cryptic about it. When you read the following line, replace lambda by function in your mind:
>>> f = lambda x: x + 1
>>> f(3)
4
It just defines a function of x. Some other languages, like R, say it explicitly:
> f = function(x) { x + 1 }
> f(3)
4
You see? It's one of the most natural things to do in programming.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment