Thursday, November 12, 2015

Functional Programming principles

Functional programming has 2 principles:

  • Functions are first class values
    • pass them as parameter
    • return them from a function
    • store them in variable
    • define function inside a function
    • have function literals in the code - like int lieral 42 => anon function
  • Operations should map input values to output
    • Not change data in place - like what OO does
    • Makes data immutable
    • No side-effects => referentially transparent

No comments: