------------------------------------------------------------------------------
MC logo
Functional Programming
[^] Chapter Outlines
------------------------------------------------------------------------------
[Ch. 1: Overview and History] [Syntax] [Names and Scope] [Types and Type Systems] [Semantics] [Functions] [Memory Management] [Imperitive Programs and Functional Abstraction] [Modular and Class Abstraction] [Functional Programming] [Logic Programming]
<<Modular and Class Abstraction Logic Programming>>
  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.
  4. Lambda calculus.
    1. Church, 1941. Wikipedia art.
    2. The lambda operator creates an anonymous function. λx • x × x
    3. Apply a function to its argument by setting them next to each other. (λx • x × x) 2
    4. Rules:
      LambdaExpressionvariable | ( M N ) | (λ variable • M )
      MLambdaExpression
      NLambdaExpression
    5. Bound and free: Bound variables are parameters; free are what's left.
    6. Substitution M[x ← N].
      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)[x ← y] = (zy)
      4. (zx)[z ← (λz • x + z)] = ((λz • x + z)x)
      5. x • x × x)[x ← (λz • x + z)] = (λx • x × x)
    7. ((λx • MN) ⇒ M[x ← N]
    8. Values are always functions, since there's nothing else.
    9. Applied lamdba calculus adds number and such.
  5. Lisp variations langauges approximate an applied lamda calculus.
  6. Notice that define is really a kind of assignment. No one has figured out how to dispense with the impurity.
  7. Lists
    1. Heap.
    2. Dot pairs.
  8. Macros and unevaluated arguments.
<<Modular and Class Abstraction Logic Programming>>