## Pure functions? What the heck are those ?!?!

What is the basis for reason? And mathematics?

Moderators: AMod, iMod

Skepdick
Posts: 8305
Joined: Fri Jun 14, 2019 11:16 am

### Pure functions? What the heck are those ?!?!

Mathematicians keep talking about "pure" functions. A pure function is a function that has no external input and no external output (no side-effects). What incoherent nonsense is this?

An Input is the universe affecting the function.
An output is the function affecting the universe.

Inputs/Outputs ARE side-effects!

If we use Python as a model of computation this is a pure function, but it does nothing:

Code: Select all

``   def f(): pass # Mathematical equivalent unknown ``
This is NOT a pure function. It has outputs.

Code: Select all

``   def g(): return 1 #Mathematical equivalent f() = 1 ``
This is NOT a pure function. It mandates input.

Code: Select all

``   def h(x): pass # Mathematical equivalent unknown ``
This is NOT a pure function - it mandates input and produces output:

Code: Select all

``   def j(x): return x. # Mathematical equivalent f(x) = x ``
This is a pure function. It calculates the answer to 2+2, but doesn't give you the answer.

Code: Select all

``   def k(): 2+2 # Mathematical equivalent unknown ``
If one takes an extensional view of functions, thereare no such things as pure functions!

Mathematicians, do you even know what you are talking about when you talk about "pure functions"?