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
Brian McKenna
May 13, 2014
Programming
0
66
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
580
LambdaConf: Idris Workshop
puffnfresh
2
130
Other Decks in Programming
See All in Programming
Server Side Kotlin Meetup vol.16: 内部動作を理解して ハイパフォーマンスなサーバサイド Kotlin アプリケーションを書こう
ternbusty
3
230
なんでRustの環境構築してないのにRust製のツールが動くの? / Why Do Rust-Based Tools Run Without a Rust Environment?
ssssota
8
23k
Developer Joy - The New Paradigm
hollycummins
1
350
Leading Effective Engineering Teams in the AI Era
addyosmani
7
570
他言語経験者が Golangci-lint を最初のコーディングメンターにした話 / How Golangci-lint Became My First Coding Mentor: A Story from a Polyglot Programmer
uma31
0
340
iOSでSVG画像を扱う
kishikawakatsumi
0
160
コードとあなたと私の距離 / The Distance Between Code, You, and I
hiro_y
0
190
Go言語の特性を活かした公式MCP SDKの設計
hond0413
1
450
kiroとCodexで最高のSpec駆動開発を!!数時間で web3ネイティブなミニゲームを作ってみたよ!
mashharuki
0
860
Building, Deploying, and Monitoring Ruby Web Applications with Falcon (Kaigi on Rails 2025)
ioquatix
4
2.5k
スマホから Youtube Shortsを見られないようにする
lemolatoon
27
33k
AI Agent 時代的開發者生存指南
eddie
4
2.1k
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
30
2.9k
Six Lessons from altMBA
skipperchong
29
4k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.7k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
15k
Optimizing for Happiness
mojombo
379
70k
Building an army of robots
kneath
305
46k
Statistics for Hackers
jakevdp
799
220k
A better future with KSS
kneath
239
18k
The Straight Up "How To Draw Better" Workshop
denniskardys
238
140k
The Cult of Friendly URLs
andyhume
79
6.6k
How to Ace a Technical Interview
jacobian
280
24k
Build The Right Thing And Hit Your Dates
maggiecrowley
37
2.9k
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!