+ 1
What is functional programming?
I was roaming around Q/A forum and there is see a question about c as functional programming. I googled it also.,but i cant get the point . So, can anyone please explain me about the *functional programming* in a easy language.
7 odpowiedzi
+ 4
Seb TheS First... I want to commend your attempt to explain the differences between pure and impure functions. However, it's a bit off point and not entirely accurate.
That's not completely uncommon for this type of question. The subtleties aren't always easy to grasp upon initial review.
Take a look at the thread posted here by ✳AsterisK✳ ... It's become a solid resource for understanding this. 😉👌
+ 3
this is the thread https://www.sololearn.com/Discuss/1934354/?ref=app
+ 2
David Carroll shared some links on the thread, read from it and you will have great understanding of what it is
+ 2
✳AsterisK✳ Will you please share the link to me
+ 2
i am unable to find that
+ 1
It is a style of programming.
One of it's principles is to avoid using inpure functions, because it can reduce the readability of the code.
An example:
You want to change variable b with a function:
int b = 7;
The inpure function way to do this is to change it from a function:
void f1() {b = 9;}
f1();
b is now 9.
If you were reading the code, you might not have noticed b's value has changed.
Pure functions way to do it, is to change b's value with the return value:
int f2() {return 11;}
b = f2();
b is now 11.
When you read the code, b = f2() might give a message, that b's value can be somehow important. And f2 would have something to do with the variable b.
+ 1
they're more than one, just scroll down through the thread