Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Functional Geekery for an Imperative Mind

Functional Geekery for an Imperative Mind

Slides for the talk at RubyConf India 2015

Rajeev Bharshetty

April 04, 2015
Tweet

More Decks by Rajeev Bharshetty

Other Decks in Programming

Transcript

  1. PROPERTY IMPERATIVE FUNCTIONAL FOCUS Changing existing values Declaring new values

    CONTROL FLOW Loops, Conditionals and Function calls Functional calls including Recursion MANIPULATION UNIT Instances of classes and structs Functions and Data Structures. MENTAL MODEL Algorithmic Programming Composing problems with set of functions.
  2. – John Hughes (Why Functional Programming Matters) “Functional Programming is

    so called because a program consists entirely of functions”
  3. It is the act of pipelining result of a function

    into input of another, creating a new function
  4. Function g(x) x + 1 Function f(x) x * x

    x = 3 g(x)= 4 f(g(x))= 16
  5. It is the act of pipelining result of a function

    into input of with another, creating a new function
  6. REFERENTIAL TRANSPARENCY Expression is referentially transparent if it can be

    replaced with its value Property of Pure functions No side effects Easier to reason about programs
  7. REFERENCES Haskell Wiki Learn You a Haskell Ruby Function Composition

    Resurgence of Functional Programming Code samples