elixir

Elixir is a functional programming language created by José Valim.

atoms

Atoms are constants whose names are their values.

:x :x
:x == :y false

string manipulation

name = "David"
"Hello #{name}" "Hello David"
"Hello " <> name "Hello David"

grimoire

labeling IO.inspect

IO.inspect("meow", label: "cat")
cat: "meow"

truncating maps in IO.inspect

IO.inspect(["Hello", "world"], limit: 1) # :infinity
["Hello", …]
["Hello", "world"]

IO.inspect in colour

IO.inspect(_, syntax_colors: IO.ANSI.syntax_colors())

using cassettes

describe "function/1" do
  test "case" do
    use_cassette "path/cassette", match_requests_on: [:headers] do
      # …
    end
  end
end
def check(condition) do
  if condition, do: "yes", else "no"
end
def check(true), do: "yes"
def check(false), do: "no"

mix

a medallion on part of an embroidered imperial robe with the White Hare of the Moon, at the foot of a cassia tree, making elixir of immortality
the moon rabbit

Mix is a build tool for Elixir and facilitates creation, compilation, testing, and dependency management.

install packages

mix deps.get

checking code coverage

MIX_ENV=test mix coveralls.detail --filter file.ex

list outdated dependencies and purge unused dependencies

mix hex.outdated
mix deps.clean --unlock --unused

resources