26 ms·
By the way... your conception of a pure function is incoherent. Parameters ARE inputs. Results ARE outputs. Renaming them to something else is just obscuring t
by ukj 5y ago
By the way... your conception of a pure function is incoherent.
Parameters ARE inputs. Results ARE outputs. Renaming them to something else is just obscuring the fact that you are still talking about a function with side-effects.
So using Python as my model of computation this is a pure function, but it does nothing:
def f(): pass
This is NOT a pure function. It has outputs.
def g(): return True
This is NOT a pure function. It mandates input.
def h(x): pass
This is NOT a pure function - it mandates input and produces output:
def j(x): return x
This is a pure function. It calculates the answer to 2+2, but doesn't tell you what it is.
def k(): 2+2
If pure functions take no input and produce no output, what is there left to analyse? What is Logic and Mathematics talking ABOUT?