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
Functional Geekery for an Imperative Mind
Search
Rajeev Bharshetty
April 04, 2015
Programming
320
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Functional Geekery for an Imperative Mind
Slides for the talk at RubyConf India 2015
Rajeev Bharshetty
April 04, 2015
More Decks by Rajeev Bharshetty
See All by Rajeev Bharshetty
SPDY : Let's Make the Web Faster
rshetty01
2
180
Other Decks in Programming
See All in Programming
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
130
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
JIS keyboard support in Omarchy
lef237
0
120
sbt 2.0: takeoff
eed3si9n
0
160
golang-bob.pdf
iwatsukayura
0
130
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
270
HTML-in-Canvasで作る未来のWeb UI表現
clockmaker
5
5.1k
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
210
最近”作らせてる” ローカルAIアプリの話
akit37
0
470
S3 TablesのIcebergデータに、AIエージェントからアクセスしてみた / 20261016developersio2026joetsu-accessing-iceberg-in-s3tables-via-agent
kasacchiful
PRO
0
150
UPDATE をやめる — EF Core でマスタをバージョン管理する
panda728
PRO
0
1.2k
ActionController meets Protocol Buffers
sorah
0
530
Featured
See All Featured
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
380
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
560
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
520
BBQ
matthewcrist
90
10k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
220
First, design no harm
axbom
PRO
2
1.3k
Leo the Paperboy
mayatellez
10
2.4k
WENDY [Excerpt]
tessaabrams
14
40k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Transcript
FUNCTIONAL GEEKERY FOR AN IMPERATIVE MIND Rajeev N B
@rshetty on Github @rbharshetty on Twitter
None
SIMON PEYTON JONES
NIRVANA C, C++, Java, Ruby .. Haskell Nirvana Useful Less
Useful Unsafe Safe
IMPERATIVE VS FUNCTIONAL
PROPERTY IMPERATIVE FUNCTIONAL FOCUS Changing existing values Declaring new values
CONTROL FLOW Loops, Conditionals and Function calls Functional calls including Recursion MANIPULATION UNIT Instances of classes and structs Functions and Data Structures. MENTAL MODEL Algorithmic Programming Composing problems with set of functions.
FUNCTIONAL PROGRAMMING?
– John Hughes (Why Functional Programming Matters) “Functional Programming is
so called because a program consists entirely of functions”
CONCEPTS
FUNCTION COMPOSITION (F O G)
It is the act of pipelining result of a function
into input of another, creating a new function
Function g(x) x + 1 Function f(x) x * x
x = 3 g(x)= 4 f(g(x))= 16
None
None
It is the act of pipelining result of a function
into input of with another, creating a new function
None
None
None
LAZY EVALUATION
Evaluation of a expression is deferred until the result is
needed by other computations
LAZY EVALUATION Call by need Infinite Data structures Thunks Performant
HIGHER ORDER FUNCTIONS
Functions which either take functions as arguments or return functions
as return values
None
None
CURRYING
Transforming function that takes multiple arguments into function that takes
single argument
None
None
PURE FUNCTION
Function that returns exactly the same result every time it
is called with same set of arguments
Pure Function f(x) = Math.cos(x) Pure Function ( No Side
Effects ) x f(x)
None
REFERENTIAL TRANSPARENCY Expression is referentially transparent if it can be
replaced with its value Property of Pure functions No side effects Easier to reason about programs
WHY PURE FUNCTIONS? Reproducible results Memoization Parallelization
IMMUTABILITY
Immutable object is an object whose state cannot be modified
after it is created
IMMUTABLE DATA STRUCTURES Data structure once created cannot be modified
Uses sophisticated structure sharing
WHY? Concurrency Security
FUNCTIONAL THINKING
REFERENCES Haskell Wiki Learn You a Haskell Ruby Function Composition
Resurgence of Functional Programming Code samples
THANKS
QUESTIONS?