Roberto Lopez has over 20 years of experience in IT, starting as a help desk technician and later founding his own consulting firm focused on Microsoft technologies. He is currently learning Haskell and Elm. Functional programming is a paradigm based on mathematical functions that treats functions as first-class citizens and avoids side effects. It emphasizes concepts like pure functions, immutability, recursion, and lazy evaluation. Functional programming can provide benefits like easier reasoning about programs and fewer bugs.
3. FUNCTIONAL PROGRAMMING
ROBERTO LOPEZ
Over 20 Years in IT
Started as a Help Desk technician
11 years ago started RHLopez Consulting, Inc.
Primarily work with Microsoft .Net and .Net Core
Application Development, Software Architecture, Systems Integration, Database Design, Report Writing
Manufacturing, Financial, Management, Higher Education, E-commerce, Media Sectors
Learning Haskell, Elm
E-mail: roberto@rhlopez.com
Twitter: @ralmlopez
Phone: 615-604-0813
6. FUNCTIONAL PROGRAMMING
WHY SHOULD I
CARE?
A different way of thinking / solving a problem
Less typing (succint)
Higher levels of abstraction
Easier to reason about a program
Less bugs - no nulls, sum types
7. FUNCTIONAL PROGRAMMING
WHAT IS IT?
Functional programming is so called because its fundamental operation is
the application of functions to arguments
John Hughes, Why Functional Programming Matters
8. FUNCTIONAL PROGRAMMING
WHAT IS IT?
Functional programming is a computer programming paradigm that relies
on functions modeled on mathematical functions. The essence of functional
programming is that programs are a combination of expressions.
Haskel Programming from First Principles, Chris Allen and Julie Moronuki
8
9. FUNCTIONAL PROGRAMMING
WHAT IS IT?
Based on lambda calculus - Alonzo Church 1930s
Turing complete
了x.(x + 1) => 了x.(x + 1) 3 => [x := 3] => 3 + 1 => 4
Expressions, variables, and abstractions
Expressions = variables | abstractions
Abstractions = functions
9
10. FUNCTIONAL PROGRAMMING
CHARACTERISTICS
Functions are First-Class, Higher-Order
Pure Functions (No Side-Effects)
Referential Transparency
Immutability
Currying
Partial Application
Recursion
Lazy
11. FUNCTIONAL PROGRAMMING
CHARACTERISTICS -
FUNCTIONS FIRST-CLASS
Functions treated as first-class variables
Can be passed to functions as parameters
Can be returned from functions
Functions that take or return functions are called higher-order
functions
18. FUNCTIONAL PROGRAMMING
CHARACTERISTICS - LAZY
Since functions are pure and have referential integrity they can be
called at any time and yield the same result
This makes it possible to delay computation until needed
19. FUNCTIONAL PROGRAMMING
HASKELL TYPES
No Nulls
Sum Types
I call it my billion-dollar mistake. It was the invention of the null reference
in 1965. This has led to innumerable errors, vulnerabilities, and system
crashes, which have probably caused a billion dollars of pain and damage
in the last forty years.
Tony Hoare
19
20. FUNCTIONAL PROGRAMMING
LEARNING
Can be frustrating
Pure functional vs hybrid languages
Some pure languages: Haskell, Elm, Idris, PureScript
.Net - F#
Java - Clojure and Scala
Erlang and Elixir
Javascript
Python
21. FUNCTIONAL PROGRAMMING
RESOURCES
Haskell Programming from first principles - Chris Allen and Julie
Moronuki
Programming Elm - Jeremy Fairbank
Haskell Weekly
Elm Town, Javascript to Elm
Functional Geekery
Lambda Cast