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
64
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
100
PureScript
puffnfresh
2
580
LambdaConf: Idris Workshop
puffnfresh
2
130
Other Decks in Programming
See All in Programming
バイブコーディング × 設計思考
nogu66
0
120
CLI ツールを Go ライブラリ として再実装する理由 / Why reimplement a CLI tool as a Go library
ktr_0731
3
1.1k
Reactの歴史を振り返る
tutinoko
1
180
DockerからECSへ 〜 AWSの海に出る前に知っておきたいこと 〜
ota1022
5
1.5k
GUI操作LLMの最新動向: UI-TARSと関連論文紹介
kfujikawa
0
970
MCP連携で加速するAI駆動開発/mcp integration accelerates ai-driven-development
bpstudy
0
300
ワープロって実は計算機で
pepepper
2
1.4k
令和最新版手のひらコンピュータ
koba789
14
7.8k
Understanding Kotlin Multiplatform
l2hyunwoo
0
260
エンジニアのための”最低限いい感じ”デザイン入門
shunshobon
0
110
WebAssemblyインタプリタを書く ~Component Modelを添えて~
ruccho
1
850
Introduction to Git & GitHub
latte72
0
110
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
53
8.8k
How to Think Like a Performance Engineer
csswizardry
25
1.8k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Documentation Writing (for coders)
carmenintech
73
5k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.9k
Balancing Empowerment & Direction
lara
2
570
Typedesign – Prime Four
hannesfritz
42
2.8k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
9
770
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!