Into the Land of Lambda 
(into functional-programming (one 
(programmers-journey)))
Who am I? 
Currently, a programmer @livingsocial 
Previously a software consultant at various Fortune 1000 companies, including 
banking, pharma, and transportation sectors 
Lots of work with start-ups since 2005 
Speaker at first Rails Conf (‘06), Ruby Conf 
(‘08) 
Sarasota resident since ‘96  
mike.pence@livingsocial.com 
@mikepence
The context of my experience… 
Tools I have known and loved (starting out)
The context of my experience… 
Tools I have known and loved (oy! the 90’s!) 
You had to re-invent yourself every 2 years 
The context of my experience… 
True love since ’05 (well, love/hate with Rails)
~25 years of OOP (for me) 
How come it isn’t getting any easier?
Our relationship with objects 
It’s complicated 
• Graphs (trees) of objects maintain 
internal state at every level in the 
call stack 
• Bugs are the product of 
programmatic logic + the transient 
state of the world at the time of the 
error 
• Example-based unit or integration 
tests are of limited usefulness (they 
prove their example case, but 
nothing more) 
• No guarantee that calling the same 
method with the same arguments 
will return the same result (aka 
referential transparency) because 
variables
Reasoning about objects 
Feels Like A Shell Game
Attempts to make OOP better 
Each with their own trade-offs… 
• Dependency injection / AOP 
• Following SOLID design principles 
• Single Responsibility Principle 
• Liskov Substitution Principle 
• Etc. 
• Hexagonal Architecture 
• Ports and Adapters 
• Pipes and Filters 
Still the fundamental problem remains that 
state is casually managed, if managed at all. 
Nevermind concurrency!
This Talk Gets Its Own Slide 
“Are we there yet?” 
http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey 
The conflation of behavior, 
state, identity and time is a big 
source of implicit complexity in 
current object systems. 
We should primarily be 
programming with pure 
functions and immutable 
values. 
- Rich Hickey
Is There a Different Way? 
(Spoiler alert: There is!)
Another way 
Disambiguating identity, value, time and mutation
Statefulness, YAGNI 
Avoid it most of the time. Manage it when you need it. 
• 99% of the time, you don’t need internal state in functions / methods 
• As an exercise, try passing in variables and having mutated values returned in 
<language you use daily> 
• But Clojure is not about avoiding state, it is about managing it with well-defined 
semantics 
• To re-iterate, identity is a sequence of states 
• America is an identity 
• The PIC (prez, vice prez) are transient
A couple more analogies 
State is like garbage, or Buddhism (which is not) 
• Clojure provides "managed time" in much the same way that GC's have come to 
provide managed memory 
• * My team at LS offered a lot of this content 
• They say Buddhists with advanced training don't see a "video" through their eyes, 
but something like a series of pictures, like a flip book 
• This "epochal state model" concept is similar, differs in that there are multiple 
perceivers observing/looking at many flowing identities
Code Examples 
Let’s See Some!
Some Code Samples 
Here they are! 
• http://nakkaya.com/2009/10/04/fractals-in-clojure-buddhabrot-fractal/ 
• http://wicketconsole.appspot.com/clojureWithTemplates 
• http://www.slideshare.net/alexmiller/clojure-the-art-of-abstraction-7161663
A Whole New World 
Full of win!
Clojure / FP Wins 
Reliability 
• Code is “provable” because it lacks transient variables 
– Tests pass in all required state 
– Example-based (unit) tests are great 
• Generative tests are better 
• Stepping debuggers and similar approaches to diagnosing functions with variables 
are simply not needed (but are available). 
• My experience so far has been that a whole class of bugs simply don’t occur
Clojure / FP Wins 
Focus 
• You focus on a small set of hierarchical data structures and the functions that 
process them 
– Visualize any JSON nested structure you have seen 
• Biggest take-away for me 
– You simply don’t need all of the ceremony of OOP 
"It is better to have 100 functions operate on one data structure than 10 functions on 
10 data structures." — Alan Perlis
Clojure / FP Wins 
Expressivity and elegance 
• Your functions and the built-in functions, or library functions, are syntactical peers 
• So no awkwardly implemented DSL’s 
• No odd, arbitrary-seeming mix of infix, postfix and dot notation 
• It is functions, all the way down 
• So you can freely build your own vocabulary of functions to model your problem 
domain and solution 
• Which I am really excited to see in practice 
• Also, macros!
Clojure / FP Wins 
Access to awesome libraries and community 
https://github.com/trending?l=clojure&since=weekly
Clojure / FP Wins 
More 
• Concurrent and performant 
• On the JVM 
• With all the goodness that brings 
• Used by LivingSocial for their massive email processing needs 
• Plays well with Java 
• But not just for Java! 
• CLR version 
• Enables Unity3D and Unreal Engine programming! 
• JavaScript version 
• ClojureScript 
• A whole awesome thing in its own right 
• Port of Clojure’s immutable data structure libraries included 
• Om and React.js, OMG! 
• You could program for tablets, consoles, phones, etc. 
• LightTable!
Adorable!
Thank you! 
For Your Participation
Questions and Discussion 
This subheading intentionally left blank