Functional Programming
  1. Functional language: Everything is done calling functions.
    1. Mathematical 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. A Short Introduction
    3. The lambda operator creates an anonymous function. Maybe:
      λx.x×x
      But you've already put in a lot of work if you've already managed to define multiplication.
    4. Apply a function to its argument by setting them next to each other. (λxx×x)2
    5. An expression in the language, a term is:
      • Variable x is a term.
      • If M and N are terms, (MN) is.
      • If x is a variable, and M is a terms, (λx.M) is a term.
    6. Values, to the extent they exist, are other terms, generally functions.
    7. Everything is expressed by substitution of a term for the variables of another.
    8. Substitution M[x:=N].
      1. Generally, just substitute N for all free occurrences of x in M. (A free occurrence is one that is not already being used as a lambda parameter.)
      2. (zx)[x:=y]=(zy)
      3. (zx)[z:=(λz.x+z)]=((λz.x+z)x)
      4. (λx.x×x)[x:=(λz.x+z)]=(λx.x×x)
    9. ((λx.M)N)M[x:=N]
    10. Values are always functions, since there's nothing else. Certain functions are taken to represent numbers, and arithmetic can be defined.
    11. Rather theoretical for my taste, but used to explore the limits of computation.
  3. Lisp
    1. Lisp variations languages approximate an applied lambda 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.
  5. Haskell. Notes coming soon.