on Pluralsight) » presented by José Valim (created of Elixir) » parse the meta-data for a collection of video streaming files » and that was the first day a transformation began @nicholasjhenry, #myelixirstatus 11
the Erlang VM 2. Functional Programming Language 3. Created by José Valim 4. It's not "Ruby on the Erlang VM" 5. Yes, there is a web framework - Phoenix @nicholasjhenry, #myelixirstatus 15
function that creates a new customer: * name cannot be blank. * state cannot be blank. * domain cannot be blank. * enabled must be true to start with. @nicholasjhenry, #myelixirstatus 22
state: nil, domain: nil, enabled: true def create(name, state, domain) do if name == "" do IO.puts "Name cannot be blank" else if state == "" do IO.puts "State cannot be blank" else if domain == "" do IO.puts "Domain cannot be blank" else %Customer{name: name, state: state, domain: domain} end end end end end @nicholasjhenry, #myelixirstatus 27
{:hello, "world", 42} iex> {:gidday, b, c} = {:hello, "world", 42} ** (MatchError) no match of right hand side value: {:hello, "world", 42} @nicholasjhenry, #myelixirstatus 38
enabled: true def create(name, state, domain) do if name == "" do IO.puts "Name cannot be blank" else if state == "" do IO.puts "State cannot be blank" else if domain == "" do IO.puts "Domain cannot be blank" else %Customer{name: name, state: state, domain: domain} end end end end end @nicholasjhenry, #myelixirstatus 40
do defstruct name: nil, state: nil, domain: nil, enabled: true def create(name, state, domain) do case {name, state, domain} do # some pattern matching here soon end end end @nicholasjhenry, #myelixirstatus 41
do defstruct name: nil, state: nil, domain: nil, enabled: true def create(name, state, domain) do # case :term case {name, state, domain} do # clause (:head -> :body) {"", _state, _domain} -> IO.puts "Name cannot be blank" end end end @nicholasjhenry, #myelixirstatus 42
do defstruct name: nil, state: nil, domain: nil, enabled: true def create(name, state, domain) do case {name, state, domain} do {"", _state, _domain} -> IO.puts "Name cannot be blank" {_name, "", _domain} -> IO.puts "State cannot be blank" end end end @nicholasjhenry, #myelixirstatus 43
do defstruct name: nil, state: nil, domain: nil, enabled: true def create(name, state, domain) do case {name, state, domain} do {"", _state, _domain} -> IO.puts "Name cannot be blank" {_name, "", _domain} -> IO.puts "State cannot be blank" {_name, _state, ""} -> IO.puts "Domain cannot be blank" end end end @nicholasjhenry, #myelixirstatus 44
general) moves me away from an imperative approach, towards a more declarative approach, producing more expressive code. @nicholasjhenry, #myelixirstatus 51
at once » Parallelism: doing multiple things at once 10 http://concur.rspace.googlecode.com/hg/talk/concur.html#slide-5 @nicholasjhenry, #myelixirstatus 72
do # {atom, query_time, text} "Ruby" -> {:ok, 100, "Ruby is a dynamic, reflective, object-oriented..."} "Python" -> {:ok, 2000, "Python is a widely used general-purpose, high-level..."} "Elixir" -> {:ok, 4000, "Elixir is a functional, concurrent, general-purpose..."} _ -> {:error, 10000, "Results not found" } end result = {_, query_time, _} :timer.sleep query_time result end end @nicholasjhenry, #myelixirstatus 80
Thomas 3 2. Work through the Elixir Guides 4 3. Start practicing on Exercism.io 5 5 http://exercism.io/ 4 http://elixir-lang.org/getting-started 3 http://bit.ly/think-diff @nicholasjhenry, #myelixirstatus 100