Types of Function

The fight between Purity(Pure) and Impurity(Non-Pure)

Pure function:
These are those wonderful creature that obey your order and create NO side effects. They only do what they are intended to do.
def abs(x):
if x>0 return x else return -x

All this function does is for some input value generates an output value. Thats it! No other crap!

On the other hands the NAUGHTY child of the programming family. Non Pure functions, In addition to returning the value that they were meant to return, they generate some side effect, make some changes to the environment! Idiots!
print(1) :
print function return a value None in python but displays some content on the console(Side Effect)

Try in Python 3.* : print(print(“Side”), print(“Effect!”))

To-DO :
Add advantages of using pure functions!

 
4
Kudos
 
4
Kudos

Now read this

What is Machine Learning?

Wikipedia - Machine Learning Machine Learning is a sub-field of Artificial Intelligence. Arghhh!! Now what is Artificial Intelligence(AI)? Wiki says “AI is intelligence exhibited by machines”. So Machine Intelligence is AI and... Continue →