Functional Programming
  1. Functional language: Everything is done calling functions.
    1. Mathmatical variables represent expressions and don't change.
      No assignment statement in math
    2. Pure functional languages do not have any form of assignment.
      Most are not pure
    3. The value of a function or operation depends only on the values of its arguments.
  2. Background of Lisp: Lambda calculus.
    1. Church, 1941. Wikipedia art.
    2. The lambda operator creates an anonymous function. λxx×x
    3. Apply a function to its argument by setting them next to each other. (λxx×x)2
    4. Rules:
    5. Bound and free: Bound variables are parameters; free are what's left.
    6. Substitution M[xN].
      1. Generally, just substitute N for all free occurrences of x in M.
      2. First, though, if N's un-bound variables are bound in M (this is, if they are used as parameters), rename them to remove conflicts, so the substitution leaves the free variables of N free. (Obviously, parameter names are indifferent.)
      3. (zx)[xy]=(zy)
      4. (zx)[z(λzx+z)]=((λzx+z)x)
      5. (λxx×x)[x(λzx+z)]=(λxx×x)
    7. ((λxM)N)M[xN]
    8. Values are always functions, since there's nothing else.
    9. Applied lamdba calculus adds number and such.
  3. Lisp
    1. Lisp variations langauges approximate an applied lamda calculus.
    2. Notice that define is really a kind of assignment. No one has figured out how to dispense with the impurity.
    3. Lists
      1. Heap.
      2. Dot pairs.
    4. Macros and unevaluated arguments.
  4. OCaml
    1. One of several newer languages descended from ML.
    2. Functional language with a conventional syntax.
    3. Hello, World!
    4. Iteration
    5. Madlib code and input.
    6. OCaml also has strong static typing, while Lisp is dynamically typed.