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

Fun with Elixir and the Erlang VM

yawnt
October 05, 2013
220

Fun with Elixir and the Erlang VM

Introduction to Elixir, a metaprogramming friendly language that runs on the top of the Erlang VM.

yawnt

October 05, 2013
Tweet

Transcript

  1. ELIXIR
    and the Erlang VM
    Fun with

    View Slide

  2. YAWNT
    Hey, i’m
    on  & 

    View Slide

  3. NODEJITSU
    I do  at

    View Slide

  4. LAZY
    Erlang concepts for the
    and the
    IMPATIENT

    View Slide

  5. functional
    Erlang is a
    language

    View Slide

  6. awesome
    As such, it has lots of
    features

    View Slide

  7. data
    Functions are

    View Slide

  8. REcursion
    It uses
    to solve problems

    View Slide

  9. Guards

    View Slide

  10. pattern
    matching

    View Slide

  11. Referential
    transparency

    View Slide

  12. PROCESSes...
    But

    View Slide

  13. Unique
    ... make Erlang

    View Slide

  14. concurrent
    Processes are

    View Slide

  15. MESSAGES
    They use
    to communicate

    View Slide

  16. picture shamelessly ripped from learnyousomEerlang

    View Slide

  17. PEOPLE
    Processes are like

    View Slide

  18. indEpendent
    They are

    View Slide

  19. fault
    They are
    tolerant

    View Slide

  20. isolated
    They are

    View Slide

  21. distributed
    They are

    View Slide

  22. BEAM
    Why a language on
    VM ?
    Recap

    View Slide

  23. concurrent
    It is
    and
    DISTRIBUTED

    View Slide

  24. FAULT
    tolerant
    It is

    View Slide

  25. OTP
    It can use

    View Slide

  26. View Slide

  27. OLD
    But Erlang is

    View Slide

  28. macros
    Silly

    View Slide

  29. syntax
    Clunky

    View Slide

  30. flexibility
    Little

    View Slide

  31. View Slide

  32. Modern
    What if we
    could use a
    language

    View Slide

  33. View Slide

  34. $ git clone \
    https://github.com/elixir-lang/elixir.git \
    .elixir
    $ cd .elixir
    $ make test
    $ echo "PATH=$HOME/.elixir/bin" >> .zshrc
    $ source .zshrc

    View Slide

  35. “ Elixir is a metaprogrammable,
    functional language built atop the Erlang
    VM. It is a dynamic language with
    hygIenic macros that leverages
    Erlang's ability to build concurrent,
    distributed, and fault-tolerant
    applications with hot code upgrades.“
    @JosEValim

    View Slide

  36. GOODNESS
    All the Erlang

    View Slide

  37. PLUS

    View Slide

  38. SYNTAX
    It has Ruby-inspired

    View Slide

  39. defmodule Hi do
    def greetings do
    IO.puts "hi 33dev!"
    end
    end

    View Slide

  40. FRIENDLY
    It is DSL

    View Slide

  41. defmodule ATest do
    use ExUnit.Case
    test "true should be true" do
    assert(true == true)
    end
    end

    View Slide

  42. MACROS
    It has powerful

    View Slide

  43. defmodule MacroTest do
    defmacro if_not(pred, block) do
    quote do
    if(!unquote(pred)) do
    unquote(block)
    end
    end
    end
    def try_unless do
    if_not 1==2 do
    IO.puts "hey"
    end
    end
    end

    View Slide

  44. protocols
    It has

    View Slide

  45. defprotocol Blank do
    def blank?(data)
    end
    defimpl Blank, for: List do
    def blank?([]), do: true
    def blank?(_), do: false
    end

    View Slide

  46. Records
    It has sane

    View Slide

  47. defrecord Trento, [people: nil, students: 0] do
    def get_people(city) do
    city.people
    end
    end

    View Slide

  48. “ Elixir is the son of ERLANG and RUBY,
    but Ruby missed out and the real father
    is LisP.“
    @DCH__

    View Slide

  49. View Slide

  50. questions?
    or hit me up later

    View Slide


  51. Thanks for listening

    View Slide

  52. NEXT
     this talk
     Erlang/OTP in Action
     elixir-lang.org
     Elixir google groups
     Programming Elixir

    View Slide