Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Boulder Startup Week: What is functional progra...
Search
Brian McKenna
May 13, 2014
Programming
76
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Boulder Startup Week: What is functional programming?
Brian McKenna
May 13, 2014
Transcript
26 slides
FUNCTIONAL PROGRAMMING
WHAT ARE FUNCTIONS?
▸ A relation from a set to a set {(true,
false), (false, true), (false, false)} ▸ One output object for every input {(true, false), (false, true)}
ACTUAL FUNCTIONS
boolean not(boolean b) { return !b; } String hello(String s)
{ return "Hello " + s; }
NOT FUNCTIONS
System.out.println("Hello world"); System.getTimeMillis(); x = x + 1; boolean update(int
j) { i += j; return j + 1; }
... functional programming is a restriction on how we write
programs, but not on what programs we can express. — Rúnar Bjarnason and Paul Chiusano, Functional Programming in Scala, 2014
EQUATIONAL REASONING
main :: IO () main = print $ sum [1,
2, 3] sum :: [Int] -> Int sum = foldl (+) 0 foldl :: (Int -> Int -> Int) -> Int -> [Int] -> Int foldl f z xs = go z xs where go z [] = z go z (x:xs) = go (f z x) xs
main :: IO () main = print $ sum [1,
2, 3] sum :: [Int] -> Int sum xs = go 0 xs where go z [] = z go z (x:xs) = go (z + x) xs
main :: IO () main = print sum' sum' ::
Int sum' = go 0 [1, 2, 3] where go z [] = z go z (x:xs) = go (z + x) xs
main :: IO () main = print sum' sum' ::
Int sum' = go (((0 + 1) + 2) + 3) [] where go z [] = z
main :: IO () main = print sum' sum' ::
Int sum' = (((0 + 1) + 2) + 3)
main :: IO () main = print sum' sum' ::
Int sum' = 6
main :: IO () main = print 6
NOT EQUATIONAL REASONING
val x = { println("Hello"); 1 } x + x
// Hello // 2
{ println("Hello"); 1 } + { println("Hello"); 1 } //
Hello // Hello // 2
PRINCIPLE OF COMPOSITIONALITY
Meaning of a complex statement is the combination of the
meanings of its parts.
COMPROMISING
Can we write partially functional programs?
TOOLS
▸ Haskell ▸ ML ▸ Scala ▸ F#
GO WRITE FUNCTIONS!
More Decks by Brian McKenna
See All by Brian McKenna
Production PureScript
puffnfresh
0
140
PureScript
puffnfresh
2
600
LambdaConf: Idris Workshop
puffnfresh
2
150
Other Decks in Programming
See All in Programming
Claude Codeのおかげでやりたいことがやれるようになったんだよォー!
sms_tech
0
190
Kotlin Fest 2026: Kotlin コンパイラに Contribute してみよう! - Kotlin/Wasm で深い再帰を書けるようにした話
ternbusty
1
420
DroidKnights 2026 Android A2UI Jetpack Compose 기반의 안전한 AI UI 렌더링 - 박제창
itsmedreamwalker
1
260
protojson における文字化けの扱い
kazuki1023
0
460
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
330
はじめてのKubernetesコントリビューション
nasa9084
0
320
Proxmox x Talos Linux x Terraform で実現するなんかいい感じの Kubernetes クラスタ / A Sleek Kubernetes Cluster Powered by Proxmox, Talos Linux, and Terraform
nnaka2992
0
300
SODA - FACT BOOK(JP)
sodainc
1
40k
Math.sumPreciseから学ぶ、ECMAScript仕様の数値の種類
syumai
0
120
Secure Your Coding Agent Like It’s Malware (v1.5) 🇬🇧 @Code.talks 2026
richargh
0
200
例外からRich Errorsまで Kotlinエラーハンドリングの進化を読み解く
shiita0903
0
240
How SRE Grew Out of Server-Side Work and Became the Team's Own / サーバサイドから始まったSREを チームに渡すまで
maaaato
0
210
Featured
See All Featured
First, design no harm
axbom
PRO
2
1.4k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
1
320
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
630
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
Mobile First: as difficult as doing things right
swwweet
225
10k
Mind Mapping
helmedeiros
1
450
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
670
What the history of the web can teach us about the future of AI
inesmontani
PRO
3
830
WENDY [Excerpt]
tessaabrams
15
41k