So, basically, now I'm studying a theoretical course about the fundamental concepts of Functional Programming. In a few next days, I'll be sharing this knowledge with you. First things first, and the first thing today is 'First-Class Citizen.' T his is a characteristic of objects. This concept applies to functions (yes, functions are indeed objects). But what the heck are First-Class Citizen functions? This means that such a function can: - Be assigned to a variable - Be passed as an argument to some other function - Be returned as a return value from another function - Be stored in data structures, such as a list, array, etc. Freaking awesome, isn't it? 🤨 First-Class Citizen functions can be very handy in capable hands. Just imagine how beautiful and reusable, yet completely incomprehensible and ugly your code could become with them (If hands are not capable) 🤣 A pretty simple example of such a function:
So, basically, now I'm studying a theoretical course about the fundamental…
110 viewsОткрыть в Telegram →
Из этого канала
- #7Type hints here are pretty strict here. Keep in mind that in the real world,…
Type hints here are pretty strict here. Keep in mind that in the real world, such functions will probably be more generic.
- #9No matter what function we pass to tripleme, it will be applied three times to…
No matter what function we pass to tripleme, it will be applied three times to the passed value. Last example for today. Take a deep breath.
- #11Enough for today 🙂 We will take a look at currying, pros of immutable…
Enough for today 🙂 We will take a look at currying, pros of immutable structures and few other functional programming concepts that we all should know to be…
- #3Oh, hello there. Here's the thing – it is quite challenging to write lengthy…
Oh, hello there. Here's the thing – it is quite challenging to write lengthy articles about complicated topics on a blog frequently, but I still want to follow…