SlideShare a Scribd company logo
Elixir Crash Intro
dennis 2015.10.23
What is Elixir?
• http://elixir-lang.org/
• Erlang VM + Ruby + Lisp(or clojure?)
• Sexy syntax: ruby style, functional
• low-latency, distributed and fault-tolerant systems on Erlang
VM
• Actor Model
• Macros ,Protocols and Sigils
• More tools such as iex, mix, hex etc.
https://github.com/elixir-lang/elixir
https://github.com/josevalim
Functional
square = fn x -> x*x end
square.(3) => 9
Enum.map(1..5, &(&1 * &1)) => [1, 4, 9, 16, 25]
defmodule MyList do
def map(list, f), do: _map(list, f, [])
defp _map([], _f, ret) do
:lists.reverse(ret)
end
defp _map([head | tail], f, ret) do
_map(tail, f, [f.(head) | ret])
end
end
Pattern Matching
[head | tail] = [1, 2, 3]
{a, b, c} = {:hello, "world", 42}
[a, [b,_,_], c] = [1, [2,3,4], 3]
x = 1; ^x=2
Actor
pid = spawn fn -> 1 + 2 end
send self(), {:hello, “world"}
receive do
{:hello, msg} -> msg
{:world, msg} -> "won't match”
end
GenServer
GenServer
• https://gist.github.com/killme2008/7d358688a6a922c1dbab
• GenServers are the go-to abstraction for building generic
servers in both Elixir and OTP.
Supervisor
• https://gist.github.com/killme2008/
a1ddf2b0fee80f6e137b
• A process which supervises other processes
called child processes
Supervisor Tree
• :observer.start()
Elixir introd
Macros
• https://gist.github.com/
killme2008/54381ae5f1bb2642d0cf
• Custom syntax
• DSL
Protocols
• Protocols are a mechanism to achieve
polymorphism in Elixir
• https://gist.github.com/killme2008/
f192804eee700511642c
Sigils
• "HELLO" =~ ~r/hello/i => true
• ~s(this is a string with "double" quotes, not
'single' ones)
• ~w(foo bar bat)
• https://gist.github.com/killme2008/
d8345301536980d1b64a
Tools
• iex : REPL
• mix: Build tool
• hex: Package manager
• Elixir.ExUnit: Unit Test Framework
Receipt
• K/V Store
• http://elixir-lang.org/getting-started/mix-otp/
introduction-to-mix.html
• Phoenix Hello World
• http://blog.fnil.net/blog/hello/
Elixir introd

More Related Content

PPTX
Scala Refactoring for Fun and Profit
PDF
Ruby is an Acceptable Lisp
PDF
Ponies and Unicorns With Scala
PDF
Ruslan.shevchenko: most functional-day-kiev 2014
PPTX
ECMAScript 2015: my favourite parts
PDF
A little bit of clojure
PDF
Introduction to meta-programming in scala
PDF
Erlang scheduler
Scala Refactoring for Fun and Profit
Ruby is an Acceptable Lisp
Ponies and Unicorns With Scala
Ruslan.shevchenko: most functional-day-kiev 2014
ECMAScript 2015: my favourite parts
A little bit of clojure
Introduction to meta-programming in scala
Erlang scheduler

Viewers also liked (20)

PPTX
我在 Mac 上的常用开发工具
PDF
PromptWorks Talk Tuesdays: Ray Zane 1/17/17 "Elixir Is Cool"
PPTX
QCon - 一次 Clojure Web 编程实战
PDF
Java 与 CPU 高速缓存
PDF
Clojure 1.8 Direct-Linking WWH
PDF
Phoenix demysitify, with fun
PDF
PDF
Elixir Elevated: The Ups and Downs of OTP at ElixirConf2014
PDF
Introducing Elixir the easy way
PPTX
Clojure的魅力
PPTX
Clojure概览
PDF
Elixir & Phoenix – fast, concurrent and explicit
PDF
Bottleneck in Elixir Application - Alexey Osipenko
ODP
Elixir basics
PDF
Learn Elixir at Manchester Lambda Lounge
PPTX
Nintendo presentation 3.0
PDF
Scala : language of the future
PDF
Scala Days NYC 2016
PPTX
Shell,信号量以及java进程的退出
我在 Mac 上的常用开发工具
PromptWorks Talk Tuesdays: Ray Zane 1/17/17 "Elixir Is Cool"
QCon - 一次 Clojure Web 编程实战
Java 与 CPU 高速缓存
Clojure 1.8 Direct-Linking WWH
Phoenix demysitify, with fun
Elixir Elevated: The Ups and Downs of OTP at ElixirConf2014
Introducing Elixir the easy way
Clojure的魅力
Clojure概览
Elixir & Phoenix – fast, concurrent and explicit
Bottleneck in Elixir Application - Alexey Osipenko
Elixir basics
Learn Elixir at Manchester Lambda Lounge
Nintendo presentation 3.0
Scala : language of the future
Scala Days NYC 2016
Shell,信号量以及java进程的退出
Ad

Similar to Elixir introd (20)

PPTX
Introduction to Haskell: 2011-04-13
PDF
Elixir
PDF
Clojure - An Introduction for Lisp Programmers
PDF
Clojure intro
PPT
LISP.ppt
PDF
Erlang Message Passing Concurrency, For The Win
PDF
Elixir for Rubyists
PDF
Pune Clojure Course Outline
PPT
Groovy unleashed
PDF
Exploring Clojurescript
PDF
Introductionto fp with groovy
PDF
SE 20016 - programming languages landscape.
PPTX
An Introduction to Functional Programming with Javascript
PDF
The Scheme Language -- Using it on the iPhone
PPTX
Elixir introduction
PPTX
A brief tour of modern Java
PDF
Playing with Elixir/Phoenix
PPTX
Functional programming and ruby in functional style
Introduction to Haskell: 2011-04-13
Elixir
Clojure - An Introduction for Lisp Programmers
Clojure intro
LISP.ppt
Erlang Message Passing Concurrency, For The Win
Elixir for Rubyists
Pune Clojure Course Outline
Groovy unleashed
Exploring Clojurescript
Introductionto fp with groovy
SE 20016 - programming languages landscape.
An Introduction to Functional Programming with Javascript
The Scheme Language -- Using it on the iPhone
Elixir introduction
A brief tour of modern Java
Playing with Elixir/Phoenix
Functional programming and ruby in functional style
Ad

More from dennis zhuang (12)

PDF
一个 Mongodb command 的前世今生
PDF
Mesos intro
PPTX
CQL 实现
PDF
Hystrix 介绍
PDF
AVOSCloud简介——万象移动云平台
PDF
Avoscloud 2
PPTX
点评新架构
ODP
Ihome inaction 篇外篇之fp介绍
PPTX
Nio trick and trap
PPTX
Aviator——轻量级表达式执行引擎
PDF
Erlang简介
PPTX
Java多线程常见陷阱
一个 Mongodb command 的前世今生
Mesos intro
CQL 实现
Hystrix 介绍
AVOSCloud简介——万象移动云平台
Avoscloud 2
点评新架构
Ihome inaction 篇外篇之fp介绍
Nio trick and trap
Aviator——轻量级表达式执行引擎
Erlang简介
Java多线程常见陷阱

Recently uploaded (20)

PPTX
Big Data Technologies - Introduction.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Spectroscopy.pptx food analysis technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Approach and Philosophy of On baking technology
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Cloud computing and distributed systems.
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
Big Data Technologies - Introduction.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Spectroscopy.pptx food analysis technology
“AI and Expert System Decision Support & Business Intelligence Systems”
MIND Revenue Release Quarter 2 2025 Press Release
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Network Security Unit 5.pdf for BCA BBA.
20250228 LYD VKU AI Blended-Learning.pptx
Approach and Philosophy of On baking technology
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Understanding_Digital_Forensics_Presentation.pptx
Cloud computing and distributed systems.
Encapsulation_ Review paper, used for researhc scholars
Review of recent advances in non-invasive hemoglobin estimation
Mobile App Security Testing_ A Comprehensive Guide.pdf
Unlocking AI with Model Context Protocol (MCP)
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Spectral efficient network and resource selection model in 5G networks
Diabetes mellitus diagnosis method based random forest with bat algorithm

Elixir introd