Skip to content

Instantly share code, notes, and snippets.

@domgetter
Last active September 27, 2016 13:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domgetter/0232ba225841e6e393b2 to your computer and use it in GitHub Desktop.
Save domgetter/0232ba225841e6e393b2 to your computer and use it in GitHub Desktop.

Vocabulary of functional programming

  • first-class function
    • when you can store a function in a variable
  • anonymous function
    • a function without a name
  • closures and pure functions
    • closure - function with at least one free variable (variable defined elsewhere)
    • pure function - a function where the variables are bound to the function's scope
      • also, a function that always returns the same output for some input
  • higher-order function
    • a function that takes a function as input, or returns a function as output
  • immutable/mutable
    • immutable - value that cannot change
    • mutable - value that can change
  • imperative/declarative
    • imperative - telling the computer what to do and how to do it
    • declarative - telling the computer what to do, but not how to do it
  • currying/partial application
    • currying - splitting a function into several functions of one parameter each
      • function add(x, y) {return x + y;} --> function(x) { return function(y) { return x + y; } }
  • unary function
    • a function which takes one input
  • aggregate function (aka reduction function)
    • a function which takes a running total and a new element, and incorporates the new element into a new total
  • predicate function
    • a function which returns true or false
  • map, filter, reduce
    • map - apply a unary function to each member of a collection
    • filter - select elements from a collection that have some property based on a predicate function
    • reduce - incorporate elements of a collection into some aggregate using an aggregate function
  • recursion
    • when a function calls itself
  • tail-call recursion
    • when a function calls itself as the last thing the function does.
@bethgrace5
Copy link

Thanks this is really applicable to the class I'm taking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment