Introduction to Functional
Programming
with Elixir
Unlearn you some OOP for great good
● OOP is not the only good way to design
software
● Assignment & Control flow are not essential
to programming
● Locks & Semaphores are not essential to
concurrency
Learn you some Functional
Programming for good
Functional Programming
● Another programming paradigm
o Functions as first class citizens
o Higher order functions
o Immutable data
o Pure functions
Pure Functions
● Stateless
● Produces the same output always for the
same input
● No side effects
Functional Programming Languages
● Haskell
● Erlang/Elixir
● Common Lisp and more
● Scala
● JavaScript
● more
The functional programming Boom
● Physical constraints
● Need for:
o Simple concurrency and parallelism
o Easier vertical and horizontal scaling
o Optimal utilization of resources
Emerging Languages
● Go
● Scala
● Erlang
● Elixir
● Rust
● Haskell
● Nim
and more
Elixir?
● Built on top of the Erlang VM
● Compiles down to BEAM bytecode
Wth is Erlang?
● Designed for scalability and real-time
systems
● Functional
● Simplifies concurrent programming
● Fault-tolerant (‘let it crash’ philosophy)
● Bytecode runs on the Erlang VM
Erlang is used by
● Facebook (Chat)
● Amazon
● Whatsapp
● Yahoo!
● Heroku
● Github
● and more
Story of Whatsapp
● 2 Million connections on a single node
● 450 Million users handled by 32 engineers
● Acquired by Facebook for $19 Billion
● Backend powered by Erlang
Elixir
● Dynamic
● Functional
● Built on top of the Erlang VM
o implies Concurrent, Distributed and Fault-tolerant
● 1.0.0 was released in Sep 2014
● Created by Jose Valim
Why use Elixir?
● All the benefits of Erlang
● Easily reuse Erlang libraries
o No additional performance costs
● Better tooling, which allows for greater
productivity
● Better syntax
● Simplified metaprogramming
Concurrency!
Concurrency in erlang/elixir vs other languages
is like branching in git vs subversion.
● Its simple and cheap
Everything is an expression
World of Elixir
Data
Modules
Processes
Datatypes
● Atoms
● Integers
● Floating point numbers
● Binaries
● Tuples
● Lists
● Strings and Character lists
● Maps, Hashdicts and Keyword Lists
Modules
● Means of organizing code
● Contains all named functions
Functions
● Elixir functions are defined by:
o Name
o Arity
● Types of functions
o Anonymous & Inline Anonymous
 inherits scope
o Named
 does not inherit scope
Pattern Matching
● Assert, not assign
● Equals sign isn’t really assignment, its more
like an assertion
● Behaviour of tuples, lists and variables in
pattern matching is important to understand
● Ignore values using _
● Force use variables using ^
Pipeline operator |>
● Formulating transformation of data
● Similar to Linux pipes
● Making functions/methods composable
● Data |> Method 1 |> Method 2 |> Method 3
Live Examples
● Sum, Multiply
● Factorial, Fibonacci, GCD
● List operations
● File operations
● Maps, Typed maps
Tooling
● Mix, a wonderful build system
● First class documentation
o Inline documentation
o Doctests
● Dependency Management using Mix
● Testing library included
Topics not covered
● Mix, `maven` for Elixir
o compatible with hex, the `maven` for Erlang
● OTP
● Metaprogramming
● Protocols
● Structs
● Streams, Enumerables, Collectables
Elixir frameworks
● Phoenix: Web framework
● Ecto: LINQ for Elixir
More: Awesome Elixir List
Questions?
Interested? You can read more here: https://github.com/hashd/LearnStack/blob/master/notes/elixir.md

More Related Content

PDF
Kotlin & Arrow the functional way
PDF
Kotlin & arrow: the functional way
PDF
Implementing DSLs in practice
PPTX
Functional Programming in JavaScript & ESNext
PPTX
Break Free with Managed Functional Programming: An Introduction to F#
PPTX
Break Free with Managed Functional Programming: An Introduction to F#
PDF
The Rise of Functional Programming
PDF
Internal domain-specific languages
Kotlin & Arrow the functional way
Kotlin & arrow: the functional way
Implementing DSLs in practice
Functional Programming in JavaScript & ESNext
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
The Rise of Functional Programming
Internal domain-specific languages

What's hot (20)

ODP
Elixir otp-basics
PPTX
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PDF
Stairway to scala flyer
PPTX
Introduction to Functional Programming and Clojure
PDF
Sprint Boot & Kotlin - Meetup.pdf
PDF
Introduction to Scala Implicits, Pimp my library and Typeclasses
PPTX
DMDW 11. Student Presentation - JAVA to MongoDB
PPTX
Not Everything Is An Object
PDF
Functional programming
PPTX
Learning programming by: Ysa & Faye
PPTX
Learning programming
PDF
A Review of Deep Contextualized Word Representations (Peters+, 2018)
ODP
Appstate
PPTX
Oop is not Dead
PDF
Functional programming scala_mod
PDF
Swift, a quick overview
PDF
2012-02-15 jfokus2012 - regex applied
ODP
PPTX
1 compiler outline
PDF
Object Oriented Programming : Part 2
Elixir otp-basics
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
Stairway to scala flyer
Introduction to Functional Programming and Clojure
Sprint Boot & Kotlin - Meetup.pdf
Introduction to Scala Implicits, Pimp my library and Typeclasses
DMDW 11. Student Presentation - JAVA to MongoDB
Not Everything Is An Object
Functional programming
Learning programming by: Ysa & Faye
Learning programming
A Review of Deep Contextualized Word Representations (Peters+, 2018)
Appstate
Oop is not Dead
Functional programming scala_mod
Swift, a quick overview
2012-02-15 jfokus2012 - regex applied
1 compiler outline
Object Oriented Programming : Part 2
Ad

Similar to Introduction to functional programming, with Elixir (20)

PDF
Functional programming
PDF
Functional Programming in Ruby
PDF
Ballerina Tutorial @ SummerSOC 2019
PPTX
Introduction to Functional Programming
PDF
Functional programming in Scala
PDF
Introduction to functional programming
PPTX
Functional programming
PDF
Elixir Brasil 2019 - Quality: A Panacéia para seu código Elixir
PPTX
Introduction to f#
PPTX
A sip of elixir
PPTX
Why functional programming in C# & F#
PDF
Introdução à Elixir
PDF
Anatomy of spark catalyst
PPTX
Airbnb Javascript Style Guide
PPTX
Python assignment help from professional programmers
PPTX
Introduction to JavaScript
PDF
Software Craftmanship - Cours Polytech
PDF
Cs3430 lecture 15
PDF
Yes scala can!
Functional programming
Functional Programming in Ruby
Ballerina Tutorial @ SummerSOC 2019
Introduction to Functional Programming
Functional programming in Scala
Introduction to functional programming
Functional programming
Elixir Brasil 2019 - Quality: A Panacéia para seu código Elixir
Introduction to f#
A sip of elixir
Why functional programming in C# & F#
Introdução à Elixir
Anatomy of spark catalyst
Airbnb Javascript Style Guide
Python assignment help from professional programmers
Introduction to JavaScript
Software Craftmanship - Cours Polytech
Cs3430 lecture 15
Yes scala can!
Ad

Recently uploaded (20)

PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
Flame analysis and combustion estimation using large language and vision assi...
PPTX
Modernising the Digital Integration Hub
PPT
What is a Computer? Input Devices /output devices
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
Configure Apache Mutual Authentication
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
PDF
CloudStack 4.21: First Look Webinar slides
PDF
Architecture types and enterprise applications.pdf
PDF
Two-dimensional Klein-Gordon and Sine-Gordon numerical solutions based on dee...
PPTX
Custom Battery Pack Design Considerations for Performance and Safety
PPTX
2018-HIPAA-Renewal-Training for executives
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PPTX
Chapter 5: Probability Theory and Statistics
Module 1.ppt Iot fundamentals and Architecture
Flame analysis and combustion estimation using large language and vision assi...
Modernising the Digital Integration Hub
What is a Computer? Input Devices /output devices
sustainability-14-14877-v2.pddhzftheheeeee
1 - Historical Antecedents, Social Consideration.pdf
Convolutional neural network based encoder-decoder for efficient real-time ob...
Final SEM Unit 1 for mit wpu at pune .pptx
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Configure Apache Mutual Authentication
A review of recent deep learning applications in wood surface defect identifi...
Credit Without Borders: AI and Financial Inclusion in Bangladesh
CloudStack 4.21: First Look Webinar slides
Architecture types and enterprise applications.pdf
Two-dimensional Klein-Gordon and Sine-Gordon numerical solutions based on dee...
Custom Battery Pack Design Considerations for Performance and Safety
2018-HIPAA-Renewal-Training for executives
NewMind AI Weekly Chronicles – August ’25 Week III
Chapter 5: Probability Theory and Statistics

Introduction to functional programming, with Elixir

  • 2. Unlearn you some OOP for great good
  • 3. ● OOP is not the only good way to design software ● Assignment & Control flow are not essential to programming ● Locks & Semaphores are not essential to concurrency
  • 4. Learn you some Functional Programming for good
  • 5. Functional Programming ● Another programming paradigm o Functions as first class citizens o Higher order functions o Immutable data o Pure functions
  • 6. Pure Functions ● Stateless ● Produces the same output always for the same input ● No side effects
  • 7. Functional Programming Languages ● Haskell ● Erlang/Elixir ● Common Lisp and more ● Scala ● JavaScript ● more
  • 8. The functional programming Boom ● Physical constraints ● Need for: o Simple concurrency and parallelism o Easier vertical and horizontal scaling o Optimal utilization of resources
  • 9. Emerging Languages ● Go ● Scala ● Erlang ● Elixir ● Rust ● Haskell ● Nim and more
  • 10. Elixir? ● Built on top of the Erlang VM ● Compiles down to BEAM bytecode
  • 11. Wth is Erlang? ● Designed for scalability and real-time systems ● Functional ● Simplifies concurrent programming ● Fault-tolerant (‘let it crash’ philosophy) ● Bytecode runs on the Erlang VM
  • 12. Erlang is used by ● Facebook (Chat) ● Amazon ● Whatsapp ● Yahoo! ● Heroku ● Github ● and more
  • 13. Story of Whatsapp ● 2 Million connections on a single node ● 450 Million users handled by 32 engineers ● Acquired by Facebook for $19 Billion ● Backend powered by Erlang
  • 14. Elixir ● Dynamic ● Functional ● Built on top of the Erlang VM o implies Concurrent, Distributed and Fault-tolerant ● 1.0.0 was released in Sep 2014 ● Created by Jose Valim
  • 15. Why use Elixir? ● All the benefits of Erlang ● Easily reuse Erlang libraries o No additional performance costs ● Better tooling, which allows for greater productivity ● Better syntax ● Simplified metaprogramming
  • 16. Concurrency! Concurrency in erlang/elixir vs other languages is like branching in git vs subversion. ● Its simple and cheap
  • 17. Everything is an expression
  • 19. Datatypes ● Atoms ● Integers ● Floating point numbers ● Binaries ● Tuples ● Lists ● Strings and Character lists ● Maps, Hashdicts and Keyword Lists
  • 20. Modules ● Means of organizing code ● Contains all named functions
  • 21. Functions ● Elixir functions are defined by: o Name o Arity ● Types of functions o Anonymous & Inline Anonymous  inherits scope o Named  does not inherit scope
  • 22. Pattern Matching ● Assert, not assign ● Equals sign isn’t really assignment, its more like an assertion ● Behaviour of tuples, lists and variables in pattern matching is important to understand ● Ignore values using _ ● Force use variables using ^
  • 23. Pipeline operator |> ● Formulating transformation of data ● Similar to Linux pipes ● Making functions/methods composable ● Data |> Method 1 |> Method 2 |> Method 3
  • 24. Live Examples ● Sum, Multiply ● Factorial, Fibonacci, GCD ● List operations ● File operations ● Maps, Typed maps
  • 25. Tooling ● Mix, a wonderful build system ● First class documentation o Inline documentation o Doctests ● Dependency Management using Mix ● Testing library included
  • 26. Topics not covered ● Mix, `maven` for Elixir o compatible with hex, the `maven` for Erlang ● OTP ● Metaprogramming ● Protocols ● Structs ● Streams, Enumerables, Collectables
  • 27. Elixir frameworks ● Phoenix: Web framework ● Ecto: LINQ for Elixir More: Awesome Elixir List
  • 28. Questions? Interested? You can read more here: https://github.com/hashd/LearnStack/blob/master/notes/elixir.md