Clojure ▸ A dynamic, functional, and compiled language designed for building scalable and maintainable applications. ▸ Leverages the Erlang VM, known for running low-latency, distributed and fault-tolerant systems, while also being successfully used in web development and the embedded software domain.
for use in their telephone network/platform. ▸ Runs on a virtual machine called the BEAM (or Erlang VM). ▸ Functional, dynamic, used for being distributed, fault-tolerant systems. ▸ Whatsapp (bought by Facebook for $19B) is built on Erlang.
"How's your #{topic} doing?" end def small_talk(:fuller, _t) do IO.puts "Mr. Director, how goes the Directing?" end small_talk(:swanson, "Fantasy Canadian Football") # How's your Fantasy Canadian Football doing? small_talk(:fuller, "Doesn't matter what I put here") # Mr. Director, how goes the Directing?
here!"} {:ok, msg} = status msg # "All good here!" {:error, msg} = status # ** (MatchError) no match of right hand side value: {:ok, "All good there!"} lunch_spots = ["Cancun", "Bub's", "Chipotle"] [first | the_rest] = lunch_spots first # "Cancun" the_rest # ["Bub's", "Chipotle"] The match operator "="
is valid dict = %{SEP: "A Software Product Design & Development Company"} dict[:SEP] = "Sucks!!" # Compilation error! dict = Map.put(dict, :Mitch, "All Star Developer") # %{ # SEP: "A Software Product Design & Development Company", # Mitch: "All Star Developer" # }
BEAM utilizes Tail Call Recursion. ▸ The Enum module abstracts away enumerating over lists, with functions like Enum.map and Enum.reduce. ▸ Pattern Matching makes recursion super easy to grok.
"thread". ▸ Able to handle millions of threads running simultaneously. ▸ Utilizes the Erlang framework, OTP (Open Telecom Platform) ▸ Standard library comes with an abstraction called a "GenServer"
processes send messages to each other and respond appropriately. ▸ Convenient way to encapsulate state. ▸ Similar to the "Actor Pattern", which some think of as "True Object Oriented" programming.
handle_call(:pop, _from, [h | t]) do {:reply, h, t} end def handle_cast({:push, item}, state) do {:noreply, [item | state]} end end # Start the server {:ok, pid} = GenServer.start_link(Stack, [:hello]) # This is the client GenServer.call(pid, :pop) #=> :hello GenServer.cast(pid, {:push, :world}) #=> :ok GenServer.call(pid, :pop) #=> :world
into the core of the language. ▸ Mix - Build tool ▸ ExUnit - Unit Testing Framework ▸ ExDoc - Documentation Generation Framework ▸ Hex - Package Manager for both Erlang and Elixir
available ▸ Some concepts aren’t available in the Elixir standard library because they are already in Erlang. ▸ Erlang modules are represented by lowercase atoms, such as :math or :timer. ▸ Gives access to Erlang Term Storage (or ETS)
class support for Web Sockets/Channels ▸ Ecto - Query Builder/ORM ▸ Plug - Composable modules for web applications ▸ Nerves - Framework for embedded devices.
Join us on slack in #elixir! ▸ Bi-monthly meet-up, Indy Elixir (www.indyelixir.org) ▸ Come bother me at Code & Coffee on Thursdays @ 7am ▸ Follow my blog www.mitchellhanberg.com