Skip to content

Instantly share code, notes, and snippets.

@avinasha

avinasha/fp.md

Created Aug 13, 2013
Embed
What would you like to do?
Learning Functional Programming; How can I use in ruby?

source

lambda calculus

  • Alonso Church
  • Formalization of computation.
  • Similar to Turing machine

implementation of lambda calculus on von Neumann computer is LISP

FP is a sub set of what lambda calculus says

Symbols

Higher Order Funcitons

  • Used to maintain state

Currying

Lazy Evaluation

Continuations

  • return to caller is a special case of continuations

Pattern Matching

Closures

def make_incr
 n=0
 lambda{ n = n + 1}.curry
end

incr1 = make_incr
incr2 = make_incr

incr1.() #=> 1
incr2.() #=> 1
incr1.() #=> 2
incr1.() #=> 3
incr2.() #=> 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment