HOME

TheInfoList



OR:

Elixir is a
functional Functional may refer to: * Movements in architecture: ** Functionalism (architecture) ** Form follows function * Functional group, combination of atoms within molecules * Medical conditions without currently visible organic basis: ** Functional sy ...
, concurrent, general-purpose
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
that runs on the BEAM
virtual machine In computing, a virtual machine (VM) is the virtualization/ emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized h ...
which is also used to implement the Erlang programming language. Elixir builds on top of Erlang and shares the same abstractions for building distributed, fault-tolerant applications. Elixir also provides productive tooling and an
extensible Extensibility is a software engineering and systems design principle that provides for future growth. Extensibility is a measure of the ability to extend a system and the level of effort required to implement the extension. Extensions can be ...
design. The latter is supported by compile-time metaprogramming with macros and polymorphism via protocols. Elixir is used by companies such as Ramp,
PagerDuty PagerDuty is an American cloud computing company specializing in a SaaS incident response platform for IT departments. It has been recognized by '' Forbes'' on its "Cloud 100" as well as the '' USA Today'' list for the top small and mid-sized co ...
, Discord,
Brex Brex Inc is an American financial service and technology company based in San Francisco, California. Brex offers business credit cards and Cash Management Accounts to technology companies. Brex cards are business charge cards, which require at ...
, E-MetroTel, Pinterest, Moz,
Bleacher Report Bleacher Report (often abbreviated as B/R) is a website that focuses on sport and sports culture. Its headquarters are in San Francisco, with offices in New York City and London. Bleacher Report was acquired by Turner Broadcasting System in ...
, The Outline,
Inverse Inverse or invert may refer to: Science and mathematics * Inverse (logic), a type of conditional sentence which is an immediate inference made from another conditional sentence * Additive inverse (negation), the inverse of a number that, when a ...
, Divvy,
FarmBot FarmBot is an open source precision agriculture CNC farming project consisting of a Cartesian coordinate robot farming machine, software and documentation including a farming data repository. The project aims to ''"Create an open and accessible ...
and for building embedded systems. The community organizes yearly events in the United States, Europe, and Japan, as well as minor local events and conferences.


History

José Valim is the creator of the Elixir programming language, a
research and development Research and development (R&D or R+D), known in Europe as research and technological development (RTD), is the set of innovative activities undertaken by corporations or governments in developing new services or products, and improving existi ...
project created at Plataformatec. His goals were to enable higher extensibility and productivity in the Erlang VM while keeping compatibility with Erlang's ecosystem. Elixir was aimed for large-scale sites and apps. Elixir uses features of Ruby, Erlang, and Clojure to develop a "high-concurrency" and "low-latency" language. Elixir was designed to handle large data volumes. Elixir is used in telecommunication, eCommerce, and finance industries. On July 12, 2018, Honeypot released a mini-documentary on Elixir.


Versioning

Elixir mostly follows semantic versioning and has only 1 major version with no plans for a second. Each of the minor versions supports a specific range of Erlang/ OTP versions. The current stable release version is .


Features

* Compiles to
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (norma ...
for the Erlang Virtual Machine (BEAM) * Everything is an expression * Erlang functions can be called from Elixir, and vice versa, without run time impact, due to compilation to Erlang bytecode * Meta programming allowing direct manipulation of
abstract syntax tree In computer science, an abstract syntax tree (AST), or just syntax tree, is a tree representation of the abstract syntactic structure of text (often source code) written in a formal language. Each node of the tree denotes a construct occurr ...
(AST) * Polymorphism via a mechanism called protocols. As in
Clojure Clojure (, like ''closure'') is a dynamic and functional dialect of the Lisp programming language on the Java platform. Like other Lisp dialects, Clojure treats code as data and has a Lisp macro system. The current development process is comm ...
, protocols provide a dynamic dispatch mechanism. However, this is not to be confused with multiple dispatch as Elixir protocols dispatch on a single type. * Support for documentation via Python-like docstrings in the
Markdown Markdown is a lightweight markup language for creating formatted text using a plain-text editor. John Gruber and Aaron Swartz created Markdown in 2004 as a markup language that is appealing to human readers in its source code form. Markdown i ...
formatting language * Shared nothing concurrent programming via message passing (
Actor model The actor model in computer science is a mathematical model of concurrent computation that treats ''actor'' as the universal primitive of concurrent computation. In response to a message it receives, an actor can: make local decisions, create mor ...
) * Emphasis on
recursion Recursion (adjective: ''recursive'') occurs when a thing is defined in terms of itself or of its type. Recursion is used in a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in mathematic ...
and
higher-order function In mathematics and computer science, a higher-order function (HOF) is a function that does at least one of the following: * takes one or more functions as arguments (i.e. a procedural parameter, which is a parameter of a procedure that is itse ...
s instead of side-effect-based
looping Looping may refer to: Media and entertainment * Loop (music), a repeating section of sound material * Audio induction loop, an aid for the hard of hearing * a film production term for dubbing (filmmaking) * repeating drawings in an animated cartoo ...
* Lightweight concurrency utilizing Erlang's mechanisms * Railway oriented programming via the with construct * Built-in tooling for managing dependencies, code compilation, running tests, formatting code, remote debugging and more * Lazy and async collections with streams *
Pattern matching In computer science, pattern matching is the act of checking a given sequence of tokens for the presence of the constituents of some pattern. In contrast to pattern recognition, the match usually has to be exact: "either it will or will not be ...
to promote assertive code *
Unicode Unicode, formally The Unicode Standard,The formal version reference is is an information technology standard for the consistent encoding, representation, and handling of text expressed in most of the world's writing systems. The standard, ...
support and
UTF-8 UTF-8 is a variable-length character encoding used for electronic communication. Defined by the Unicode Standard, the name is derived from ''Unicode'' (or ''Universal Coded Character Set'') ''Transformation Format 8-bit''. UTF-8 is capable of e ...
strings


Examples

The following examples can be run in an iex shell or saved in a file and run from the
command line A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
by typing elixir ''''. Classic Hello world example: iex> IO.puts("Hello World!") Hello World! List comprehension: iex> for n <- ,2,3,4,5 rem(n, 2)

1, do: n*n , 9, 25
Pattern matching In computer science, pattern matching is the act of checking a given sequence of tokens for the presence of the constituents of some pattern. In contrast to pattern recognition, the match usually has to be exact: "either it will or will not be ...
(destructuring): iex>
, a The comma is a punctuation mark that appears in several variants in different languages. It has the same shape as an apostrophe or single closing quotation mark () in many typefaces, but it differs from them in being placed on the baseline o ...
=
, 2 The comma is a punctuation mark that appears in several variants in different languages. It has the same shape as an apostrophe or single closing quotation mark () in many typefaces, but it differs from them in being placed on the baseline o ...
iex> a 2 iex> = iex> a "world"
Pattern matching (multiple clauses): iex> case File.read("path/to/file") do iex> -> IO.puts("found file: #") iex> -> IO.puts("missing file: #") iex> end Pipe operator: iex> "1" , > String.to_integer() , > Kernel.*(2) 2
Modules Broadly speaking, modularity is the degree to which a system's components may be separated and recombined, often with the benefit of flexibility and variety in use. The concept of modularity is used primarily to reduce complexity by breaking a s ...
: 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("#") end Asynchronously performing a task: task = Task.async fn -> perform_complex_action() end other_time_consuming_action() Task.await task


Noteworthy Elixir projects

* Mix is a build automation tool that provides tasks for creating, compiling, and testing Elixir projects, managing its dependencies, and more. * Phoenix is a web development framework written in Elixir which implements the server-side Model View Controller ( MVC) pattern.


See also

*
Concurrent computing Concurrent computing is a form of computing in which several computations are executed '' concurrently''—during overlapping time periods—instead of ''sequentially—''with one completing before the next starts. This is a property of a syst ...
*
Distributed computing A distributed system is a system whose components are located on different networked computers, which communicate and coordinate their actions by passing messages to one another from any system. Distributed computing is a field of computer sci ...


References


External links


Elixir language website
{{Authority control Concurrent programming languages Functional languages Pattern matching programming languages Programming languages Programming languages created in 2012 Software using the Apache license