Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lambda functions

I'm really interested how lambda functions are used. Does it make sense to use them in a modern, high-level programming language like php? If yes, why?

Is this really just a function embedded in a function (like this) or is there more behind them?

like image 421
therufa Avatar asked Nov 29 '22 05:11

therufa


1 Answers

A lambda term represents a function as a value. It can be passed around exactly as a value (as it is one) and yet applied by giving it some arguments. Named functions are just names that map to lambda terms, either as constants or variables (depending on the language details).

And yes, they are quite prevalent in high-level programming languages. For example, all functions in JavaScript are actually lambda terms stored in variables.

like image 119
Donal Fellows Avatar answered Dec 19 '22 02:12

Donal Fellows