Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
A gentle introduction to functional programming
Search
Stefano Armenes
April 20, 2020
Programming
1
270
A gentle introduction to functional programming
Stefano Armenes
April 20, 2020
Tweet
Share
More Decks by Stefano Armenes
See All by Stefano Armenes
reactjs_milano_intersection_2019.pdf
stearm
0
200
React with super powers using TypeScript
stearm
0
300
Other Decks in Programming
See All in Programming
ゆるい個人開発のススメ
kuroppe1819
10
950
Rails と人魚の話/rails-and-mermaid
sanfrecce_osaka
0
100
1BRC--Nerd Sniping the Java Community
gunnarmorling
0
300
App Router への移行は「改善」となり得るのか?/ Can migration to App Router be an improvement
takefumiyoshii
8
2.1k
Ruby Function Composition
bkuhlmann
1
330
TYPO3 v13 – The road to LTS: What's new and new APIs
luisasofie_xoxo
0
180
try! Swift Tokyo 2024 参加報告 / try! Swift Tokyo 2024 Report
hironytic
0
170
What We Can Learn From OSS
inouehi
0
400
大規模Reactアプリのリアーキテクチャ~8万行のTanStack Query移行の軌跡~
kj455
3
790
CQRS/ES avec Symfony, c’est (trop) bien !
jeremyfreeagent
1
630
From Spring Boot 2 to Spring Boot 3 with Java 22 and Jakarta EE
ivargrimstad
0
910
Elm Form Validation
bkuhlmann
0
510
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
782
250k
Docker and Python
trallard
33
2.7k
Building a Scalable Design System with Sketch
lauravandoore
455
32k
Why You Should Never Use an ORM
jnunemaker
PRO
50
8.6k
What’s in a name? Adding method to the madness
productmarketing
PRO
15
2.6k
Build your cross-platform service in a week with App Engine
jlugia
225
17k
Building Effective Engineering Teams - LeadDev
addyosmani
27
1.8k
Product Roadmaps are Hard
iamctodd
43
9.7k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
1
3.4k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
658
120k
Building Adaptive Systems
keathley
30
1.8k
Web Components: a chance to create the future
zenorocha
305
41k
Transcript
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING ENGINEERING MEETUP - 20TH
APRIL 2020 Luca Di Stefano, Luca Ruzzola, Stefano Armenes
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING WHY?
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING Pillars - referential transparency
- function composition - no side-effects
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING No side-effects, really? -
any operation that interacts with an external system - out-of-scope resources mutations - exceptions
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING ANYTHING IS A FUNCTION
…or better, an expression!
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING Referential transparency is all
about expression Is this function referential transparent?
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING Referential transparency is all
about expression and what about this?
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING Referential transparency is all
about expression and what about this?
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING Pure function A pure
function is a function that, given the same input, always returns the same output without producing any side-effect.
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING Pure function A pure
function is a function that, given the same input, always returns the same output without producing any side-effect. Benefits - readability - parallelisation - memoization - more testable
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING We can compose two
functions f and g when f domain is a subset of g domain. f ∘ g === f(g(x)) Composing functions
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING Composing functions …but, we
are missing somethings! We can compose two functions f and g when f domain is a subset of g domain. f ∘ g === f(g(x))
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING Partial functions We want
to live a world where every function is a total function Is this function total?
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING Cool but, why my
computation fails? Option[T]
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING Either[L, R]
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING Monads are your functional
design patterns! Choose what you need IO List Option Either Set Future … Try
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING DEMO
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING Questions?
A GENTLE INTRODUCTION TO FUNCTIONAL PROGRAMMING Thanks!