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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Brian McKenna
May 13, 2014
Programming
73
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
More Decks by Brian McKenna
See All by Brian McKenna
Production PureScript
puffnfresh
0
130
PureScript
puffnfresh
2
590
LambdaConf: Idris Workshop
puffnfresh
2
140
Other Decks in Programming
See All in Programming
ジョジョの世界をXRで再現する
mofurune
0
160
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
170
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
780
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
100
Event is what happens
moro
2
380
パスワード再設定メールのURLについて知っておこう
uyuki234
0
140
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
170
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
110
カツオ、ご期待ください
suneo3476
0
180
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
380
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
22
22k
Featured
See All Featured
A Tale of Four Properties
chriscoyier
163
24k
A designer walks into a library…
pauljervisheath
211
25k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Designing Experiences People Love
moore
143
24k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
The Invisible Side of Design
smashingmag
301
52k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3.1k
The Language of Interfaces
destraynor
162
27k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Context Engineering - Making Every Token Count
addyosmani
9
1.2k
Transcript
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!