Elixir (programming Language)
Elixir
elixir programming language
Paradigm multi-paradigm: functional, concurrent, distributed, process-oriented
First appeared 2011; 7 years ago (2011)
Stable release
1.6.6 / 19 June 2018; 32 days ago (2018-06-19)[1]
Typing discipline dynamic, strong
Platform Erlang
License Apache License 2.0[2]
Filename extensions .ex, .exs
Website elixir-lang.org
Influenced by
Erlang, Ruby, Clojure
Influenced
LFE

Elixir is a functional, concurrent, general-purpose programming language that runs on the Erlang virtual machine (BEAM).[3] Elixir builds on top of Erlang and shares the same abstractions for building distributed, fault-tolerant applications. Elixir also provides a productive tooling and an extensible design. The latter is supported by compile-time metaprogramming with macros and polymorphism via protocols.[4]

Elixir is used by companies such as E-MetroTel, Pinterest[5] and Moz.[6] Elixir is also used for web development, by companies such as Bleacher Report, Discord, and Inverse,[7] and for building embedded systems.[8][9] The community organizes yearly events in United States[10], Europe[11] and Japan[12] as well as minor local events and conferences.[13][14]

On July 12, 2018, Honeypot released a mini-documentary on Elixir.[15]

History

José Valim is the creator of the Elixir programming language, an R&D project of Plataformatec. His goals were to enable higher extensibility and productivity in the Erlang VM while keeping compatibility with Erlang's ecosystem.[16][17]

Features

Examples

The following examples can be run in an iex shell or saved in a file and run from the command line by typing elixir <filename>.

Classic Hello world example:

iex> IO.puts "Hello World!"
Hello World!

Comprehensions

iex> for n <- [1,2,3,4,5], rem(n, 2) == 1, do: n*n
[1, 9, 25]

Pattern Matching (destructuring)

iex> [1, a] = [1, 2]
iex> a
2

iex> {:ok, [hello: a]} = {:ok, [hello: "world"]}
iex> a
"world"

Pattern Matching (multiple clauses)

iex> case File.read("path/to/file") do
iex>   {:ok, contents} -> IO.puts("found file: #{contents}")
iex>   {:error, reason} -> IO.puts("missing file: #{reason}")
iex> end

Pipe Operator

iex> "1" |> String.to_integer |> Kernel.*(2)
2

Modules

defmodule Fun do
  def fib(0), do: 0
  def fib(1), do: 1
  def fib(n), do: fib(n-2) + fib(n-1)  
end

Sequentially spawning a thousand processes

for num <- 1..1000, do: spawn fn -> IO.puts "#{num * 2}" end

Asynchronously performing a task

task = Task.async fn -> perform_complex_action end
other_time_consuming_action
Task.await task

Noteworthy Elixir projects

  • Absinthe is a GraphQL implementation for Elixir
  • Ecto is a database wrapper and language integrated query for Elixir
  • Mix is a build automation tool for Elixir projects
  • Nerves is framework and platform for embedded software
  • Phoenix is a web framework built on Elixir
  • Plug is a specification and conveniences for composable modules between web applications

See also

References

External links


  This article uses material from the Wikipedia page available here. It is released under the Creative Commons Attribution-Share-Alike License 3.0.

Elixir_(programming_language)
 



 

Connect with defaultLogic
What We've Done
Led Digital Marketing Efforts of Top 500 e-Retailers.
Worked with Top Brands at Leading Agencies.
Successfully Managed Over $50 million in Digital Ad Spend.
Developed Strategies and Processes that Enabled Brands to Grow During an Economic Downturn.
Taught Advanced Internet Marketing Strategies at the graduate level.


Manage research, learning and skills at defaultLogic. Create an account using LinkedIn or facebook to manage and organize your Digital Marketing and Technology knowledge. defaultLogic works like a shopping cart for information -- helping you to save, discuss and share.

Visit defaultLogic's partner sites below:
PopFlock.com : Music Genres | Musicians | Musical Instruments | Music Industry
NCR Works : Retail Banking | Restaurant Industry | Retail Industry | Hospitality Industry

  Contact Us