0

Functional Programming - Python

I understand how functional programming works but... In which situations can this system be useful? I can't imagine a real life problem where lambda functions are needed. Thanks u all 4 help!!

13th Sep 2018, 11:56 PM
Jose Antonio
Jose Antonio - avatar
1 Resposta
+ 5
Lambda functions are not used because they are needed! When you are going to use a function only in a specific piece of code once or twice and is just a few lines it makes sense to use them. You can simply execute the function body where you define it without needing to name it. //JS code // anonymous arrow function (x=> x * x)(2) // 4 //named arrow function let sq = x => x * x sq(3) // 9 Expressing code with functional programming is also clean & elegant compared to something like imperative programming. # some reads below for perspective http://wiki.c2.com/?AdvantagesOfFunctionalProgramming https://en.m.wikipedia.org/wiki/Functional_programming
14th Sep 2018, 8:03 AM
Lord Krishna
Lord Krishna - avatar