Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Elixir

Introduction to Elixir

Slides for the "Introduction to Elixir" talk I gave at the first Elixir/Erlang meetup in Italy, set in Bologna (October 2015).

Andrea Leopardi

October 17, 2015
Tweet

More Decks by Andrea Leopardi

Other Decks in Programming

Transcript

  1. Elixir is what would happen if Erlang, Clojure and Ruby

    somehow had a baby and it wasn't an accident Devin Torres
  2. Any sufficiently complicated concurrent program in another language contains an

    ad hoc informally-specified bug-ridden slow implementation of half of Erlang. Robert Virding
  3. pid = spawn fn -> # ... end send pid,

    "a message" message passing
  4. spawn_monitor fn -> raise "die!" end receive do m ->

    m end #=> {:DOWN, ...} message passing
  5. def loop(state) do receive do {from, :get} -> send(from, state)

    loop(state) {from, :put, new_state} -> loop(new_state) end end
  6. def loop(state) do receive do {from, :get} -> send(from, state)

    loop(state) {from, :put, new_state} -> loop(new_state) end end
  7. def loop(state) do receive do {from, :get} -> send(from, state)

    loop(state) {from, :put, new_state} -> loop(new_state) end end
  8. def loop(state) do receive do {from, :get} -> send(from, state)

    loop(state) {from, :put, new_state} -> loop(new_state) end end
  9. def loop(state) do receive do {from, :get} -> send(from, state)

    loop(state) {from, :put, new_state} -> loop(new_state) end end
  10. def loop(state) do receive do {from, :get} -> send(from, state)

    loop(state) {from, :put, new_state} -> loop(new_state) end end
  11. def loop(state) do receive do {from, :get} -> send(from, state)

    loop(state) {from, :put, new_state} -> loop(new_state) end end
  12. def loop(state) do receive do {from, :get} -> send(from, state)

    loop(state) {from, :put, new_state} -> loop(new_state) end end
  13. def loop(state) do receive do {from, :get} -> send(from, state)

    loop(state) {from, :put, new_state} -> loop(new_state) end end spawn(&loop/0)
  14. so

  15. lots of companies use Elixir in prod it's awesome to

    work with thriving ecosystem, smart devs phoenix metaprogramming