Pure functions

and more maybe :)

What’s a “pure” function?

  • given same input, always returns the same output
  • execution does not cause side-effects

 

having this two things we have referential transparency

Impure vs Pure

impure function

pure funcion

Impure function

Pure funcion

pureVSimpure.js

problems.js

The end ? 

... hope not

deck

By Stefan Hagiu