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
Boulder Startup Week: What is functional progra...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Brian McKenna
May 13, 2014
Programming
0
67
Boulder Startup Week: What is functional programming?
Brian McKenna
May 13, 2014
Tweet
Share
More Decks by Brian McKenna
See All by Brian McKenna
Production PureScript
puffnfresh
0
110
PureScript
puffnfresh
2
590
LambdaConf: Idris Workshop
puffnfresh
2
130
Other Decks in Programming
See All in Programming
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
1.1k
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
570
Best-Practices-for-Cortex-Analyst-and-AI-Agent
ryotaroikeda
1
110
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
230
izumin5210のプロポーザルのネタ探し #tskaigi_msup
izumin5210
1
120
CSC307 Lecture 05
javiergs
PRO
0
500
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
3.9k
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
730
余白を設計しフロントエンド開発を 加速させる
tsukuha
7
2.1k
ぼくの開発環境2026
yuzneri
0
220
CSC307 Lecture 03
javiergs
PRO
1
490
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
190
Featured
See All Featured
The SEO identity crisis: Don't let AI make you average
varn
0
240
Become a Pro
speakerdeck
PRO
31
5.8k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
92
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
320
Into the Great Unknown - MozCon
thekraken
40
2.3k
Ruling the World: When Life Gets Gamed
codingconduct
0
140
Designing Powerful Visuals for Engaging Learning
tmiket
0
230
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Side Projects
sachag
455
43k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
310
The Spectacular Lies of Maps
axbom
PRO
1
520
Leo the Paperboy
mayatellez
4
1.4k
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!