3. Hello!
I am Omar Abdelhafith from Jordan
I live in Dublin
I write blogs on http://nsomar.com
I work with computers @Zendesk
I write mainly Swift, Haskell and Elixir
On twitter @ifnottrue
On github @oarrabi
I organize Swift and Elixir meetups (in Dublin)
11. Functional programming
Functional Programming (FP):
Is a declarative programming paradigm, where programs are
built around mathematical functions and immutable data
transformation.
13. FP is a very wide field
The definition can vary from
lenient to rigorous
14. Lenient Definition
Graham Hutton:
Functional programming is style of programming in which the
basic method of computation is the application of functions to
arguments;
• No mention of immutability
15. In-the-middle Definition
From Haskell wiki:
In functional programming, programs are executed by
evaluating expressions, ... Functional programming typically
avoids using mutable state.
... (it) requires that functions are first-class, ...(to end of quote)
• Mathematical functions is implied
16. Super Rigorus Definition
Well, Not really a definition. But,
Standarized ladder of functional programming (Lambda Conf)
21. Lambda calculus
• Alonzo Church In 1930 invented λ-calculus
• Calculation is done by lambda abstraction (definition)
and binding (application)
• There are no assignments of variables
22.
23.
24.
25. • John McCarthy created LISP in the 1950s
• Inspired from lambda calculus
• LISP is the first FP lang
• Just a bit after Fortran
• Introduced lots of concepts (macros, tree ds)
• Still alive today (Common Lisp, Dialects, etc..)
26.
27. • Created by an International comittee in 1987
• Pure functional
• lazy
• in 90s they implemented ideas from Category Theory
• functors, monads, monoids
34. Programming paradigms
• Imperative (C, C++, Java, Go):
• state and control (if, for, while)
• How to do
• Declarative (Haskell, SQL)
• logic but no control
• What to do
92. Everything is an expression
• Statments: tell how to do
• Expression: return things
• In FP: There is no void
• In Haskell ---> absurd :: Void -> a
93. Decompose
• Declarative programming paradigm ✅
• Mathematical functions ✅
• Immutable data ✅
• Everything is an expression ✅
• Functions are data
94. Functions are data
• In FP functions are data
• Higher-order function
• They can be passed to functions
• They can be returned from functions
106. Decompose
• Declarative programming paradigm ✅
• Mathematical functions ✅
• Immutable data ✅
• Everything is an expression ✅
• Functions are data ✅
107. Recap
• Declarative: What to do and not how to do it
• Mathematical functions: Pure, Total, Composable
• Immutable data: Dont change the state
• Everything is an expression: and they are composable
• Functions are data: Can be passed and returned from
functions
108. Why are we seeing a rise in FP
• Multi core and paralellism
• Determinism, testability
• They align well with cloud computing and microservices