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
Un traguito de Elixir
Search
Fernando Perales
January 10, 2018
Programming
0
230
Un traguito de Elixir
Introduction to Elixir
Talk given at Unotalks meetup on January10th 2018
Fernando Perales
January 10, 2018
Tweet
Share
More Decks by Fernando Perales
See All by Fernando Perales
Anonimización de bases de datos con PostgreSQL - nerdearla
ferperales
0
49
Let's give REST a rest: exploring the state of gRPC in Ruby
ferperales
0
130
Guía Práctica para Convertirse en Contribuidor de Open Source en 10 Años (o más)
ferperales
0
60
¿Es convertirte en manager tan malo como todo mundo dice?
ferperales
0
60
Guía práctica para convertirse en contribuidor de open source en 10 años o más
ferperales
0
47
Anonimización de bases de datos con PostgreSQL
ferperales
0
58
Guía Práctica para Convertirse en Contribuidor de Open Source en 10 Años (o más)
ferperales
0
58
Guía práctica para convertirse en Senior Engineer en 10 años
ferperales
0
130
Consultoría y Open Source: buscando el balance entre beneficio y la diversión
ferperales
0
71
Other Decks in Programming
See All in Programming
Go1.25からのGOMAXPROCS
kuro_kurorrr
1
790
Claude Codeの使い方
ttnyt8701
1
130
C++20 射影変換
faithandbrave
0
500
プロダクト志向ってなんなんだろうね
righttouch
PRO
0
130
KotlinConf 2025 現地で感じたServer-Side Kotlin
n_takehata
1
220
Is Xcode slowly dying out in 2025?
uetyo
1
180
Webの外へ飛び出せ NativePHPが切り拓くPHPの未来
takuyakatsusa
1
210
FormFlow - Build Stunning Multistep Forms
yceruto
1
190
設計やレビューに悩んでいるPHPerに贈る、クリーンなオブジェクト設計の指針たち
panda_program
4
500
A2A プロトコルを試してみる
azukiazusa1
2
960
Kotlin エンジニアへ送る:Swift 案件に参加させられる日に備えて~似てるけど色々違う Swift の仕様 / from Kotlin to Swift
lovee
1
250
Bytecode Manipulation 으로 생산성 높이기
bigstark
2
360
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
35
2.3k
Documentation Writing (for coders)
carmenintech
71
4.9k
Six Lessons from altMBA
skipperchong
28
3.8k
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
Adopting Sorbet at Scale
ufuk
77
9.4k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
8
660
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.5k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
790
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.7k
A better future with KSS
kneath
239
17k
Done Done
chrislema
184
16k
A Tale of Four Properties
chriscoyier
160
23k
Transcript
Un traguito de Elixir Fernando Perales @FerPeralesM
<me>
Fernando Perales Senior Software Engineer @ michelada.io Ing. En Computación
@ UdeG (CUCEI) Anfitrión @ RubyGDL Co-fundador @ RailsBridge México Instructor de Ruby on Rails @ Platzi Estudiante de Alemán y Bajo Eléctrico Fan de Gregory Sallust
</me>
¿Qué es Erlang? Lenguaje de programación funcional, concurrente, de propósito
general
¿Qué es Erlang? Creado en 1986 por la compañía Ericsson
Para realizar aplicaciones distribuidas, tolerantes a fallos, soft-real-time y de funcionamiento ininterrumpido
Erlang en números La máquina virtual de Erlang (BEAM) es
desarrollada por Joe Armstrong, Robert Virding y Mike Williams en 1985
Erlang en números El primer sistema en producción fue el
Switch AXD301 con 1 MLOC y disponibilidad de 9 nueves
Erlang en números
Erlang en números
Erlang en números Se libera como Open Source en 1998
Erlang en números Más del 50% del tráfico de Internet
pasa por sistemas construídos con Erlang
Erlang en números WhatsApp usa Erlang para manejar 2 millones
de conexiones por servidos
Erlang en números WhatsApp maneja 30 billones de mensajes diariamente
(347,222 msg/seg)
Erlang <> Elixir ¿Por qué mencionar Erlang cuando hablamos de
Elixir?
¿Qué es Elixir? Lenguaje de programación funcional, concurrente, de propósito
general que se ejecuta sobre la máquina virtual de Erlang (BEAM)
¿Qué es Elixir? Elixir fue creado en el 2011 por
José Valim. Un contribuidor de Ruby por bastantes años que buscaba cómo mejorar el desempeño del lenguaje para aprovechar múltiples CPUs
¿Qué es Elixir? Al investigar cómo otras tecnologías manejaban concurrencia,
encontró a Erlang
¿Qué es Elixir? Mientras la BEAM resolvía era perfecta para
el tipo de problemas que buscaba resolver, sentía que al lenguaje le faltaban características que otros lenguajes sí tenian
¿Qué es Elixir? Los programas creados en Elixir compilan a
bytecode de BEAM
¿Qué es Elixir? https://www.codeschool.com/blog/2017/02/22/why-elixir/
Ventajas heredadas de Erlang Usa una tecnología ampliamente probada por
más de 30 años
Ventajas heredadas de Erlang Facilidad de distribución de datos entre
procesos mediante GenServer
Ventajas heredadas de Erlang Auto-curación mediante Supervisors
Ventajas heredadas de Erlang Fácilmente escalable para cubrir las demandas
del futuro
Ventajas heredadas de Erlang Pattern-matching
Ventajas que Elixir aporta Sintaxis limpia y familiar
Ventajas que Elixir aporta Herramientas maduras
Ventajas que Elixir aporta Framework de pruebas unitarias integrado
Ventajas que Elixir aporta Meta-programación
Ventajas que Elixir aporta Documentación integrada
Ventajas que Elixir aporta Pipes
Ventajas que Elixir aporta Phoenix
Ventajas que Elixir aporta No hay costo de conversión al
usar código de Erlang en Elixir y viceversa
Lo que Elixir busca Distributed fault-tolerant applications with hot-code swapping
Ejemplos
Hello world iex> IO.puts "hello world" hello world :ok jeregrine.github.io/elixir-by-example
Tipos básicos: enteros iex> decimal = 1000 1000 iex> -5
-5 iex> hex = 0xabcd 43981 iex> bin = 0b1100 12 jeregrine.github.io/elixir-by-example
Tipos básicos: flotantes iex> 4.0 4.0 iex> 0.567 0.567 iex>
0.567e2 56.7 iex> 0.567e-2 0.00567 jeregrine.github.io/elixir-by-example
Tipos básicos: booleanos iex> true true iex> true == true
true iex> true == false false jeregrine.github.io/elixir-by-example
Tipos básicos: átomos iex> :stuff :stuff iex> :stuff == :stuff
true iex> :+ :+ jeregrine.github.io/elixir-by-example
Tipos básicos: átomos iex> :"Hello World!" :"Hello World!" jeregrine.github.io/elixir-by-example
Tipos básicos: binarios iex> <<1, 2, 3>> <<1, 2, 3>>
iex> size <<1, 2, 3>> 3 jeregrine.github.io/elixir-by-example
Cadenas y listas de caracteres iex> is_binary "hello" true jeregrine.github.io/elixir-by-example
Cadenas y listas de caracteres iex> name = "Paul" "Paul"
iex> "Hello #{name}!" "Hello Paul!" jeregrine.github.io/elixir-by-example
Cadenas y listas de caracteres iex> 'hello' 'hello' iex> is_binary
'hello' false iex> is_list 'hello' true jeregrine.github.io/elixir-by-example
Rangos iex> 1..3 1..3 iex> Enum.map 1..3, fn num ->
num * 2 end [2, 4, 6] jeregrine.github.io/elixir-by-example
Tuplas iex> {:stuff, 1, "things"} {:stuff, 1, "things"} jeregrine.github.io/elixir-by-example
Tuplas iex> {stuff, num, _} = {:stuff, 1, "things"} {:stuff,
1, "things"} iex> stuff :stuff iex> num 1 jeregrine.github.io/elixir-by-example
Tuplas i e x > { s t a t
u s , h a n d l e } = File.open("example.txt") {:ok, #PID<0.43.0>} jeregrine.github.io/elixir-by-example
Tuplas iex> {:ok, handle} = File.open("doesntexist.txt") ** (MatchError) no match
of right hand side value: {:error, :enoent} jeregrine.github.io/elixir-by-example
Listas iex> [1, 2, 3] [1, 2, 3] iex> [:stuff,
1, "things"] [:stuff, 2, "things"] jeregrine.github.io/elixir-by-example
Listas iex> [_, two, _] = [1, 2, 3] [1,
2, 3] iex> two 2 iex> [head | tail] = [1, 2, 3, 4] [1, 2, 3, 4] iex> head 1 iex> tail [2, 3, 4] jeregrine.github.io/elixir-by-example
Listas iex> List.flatten [1, [2, 3], 4] [1, 2, 3,
4] iex> List.zip [[1, 2, 3], [4, 5, 6]] [{1, 4}, {2, 5}, {3, 6}] iex> List.foldl [1, 2, 3], 0, fn num, acc -> num + acc end 6 jeregrine.github.io/elixir-by-example
Keyword list iex> [head | tail] = [a: 1, b:
2] [a: 1, b: 2] iex> head {:a, 1} iex> Keywords.get [a: 1, b: 2], :a 1 iex> Keywords.get_values [a: 1, b: 2] [1, 2] jeregrine.github.io/elixir-by-example
Demo
FerPerales/exercises_for_programmers_elixir
Exercises for Programmers 57 Challenges to Develop Your Coding Skills
Brian P. Hogan
¿Preguntas?
¡Gracias! @FerPeralesM
[email protected]