Editing
Erlang programming language
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
= Erlang programming language = [[File:Erlang logo.png|right|100px|alt=Erlang Logo]] '''Erlang''' is a programming language designed for building concurrent, fault-tolerant systems. Developed at Ericsson in the late 1980s, Erlang gained popularity for its ability to handle distributed and real-time applications. == Features == * [[Concurrency]] * [[Fault tolerance]] * [[Immutable data]] * [[Pattern matching]] * [[Hot code swapping]] * [[Distributed computing]] * [[Functional programming]] * [[Message passing]] * [[Erlang/OTP|OTP (Open Telecom Platform)]] == History == Erlang was created by Joe Armstrong, Robert Virding, and Mike Williams at Ericsson to improve the efficiency and reliability of telecommunication systems. It was first released as a proprietary language in 1986 and later open-sourced in 1998. == Syntax == Erlang blends functional and imperative programming styles. Its syntax is compact and uses pattern matching extensively. The following "Hello, World!" example demonstrates the basic syntax of Erlang: <pre> -module(hello_world). -export([hello/0]). hello() -> io:format("Hello, World!~n"). </pre> == Concurrency == Concurrency is a fundamental feature in Erlang. It is achieved through lightweight processes known as ''[[Erlang processes|Erlang processes]]''. These processes can communicate via message passing, allowing for efficient and concurrent programming. <pre> -module(concurrency_example). -export([start/0, worker/1]). start() -> Pid = spawn(?MODULE, worker, [5]), Pid ! {self(), double}, receive {Pid, Result} -> io:format("Doubled value: ~w~n", [Result]) end. worker(N) -> receive {From, double} -> From ! {self(), N * 2} end. </pre> == Fault Tolerance == Another key aspect of Erlang is its built-in fault-tolerant capabilities. By using ''[[Supervisor (Erlang)|supervisors]]'' and ''[[Erlang behaviors|behaviors]]'' from OTP, Erlang applications can automatically recover from failures and continue running without interruptions. <pre> -module(fault_tolerance_example). -export([start/0, worker/0, crash/0]). start() -> {ok, Pid} = supervisor:start_link({local, ?MODULE}), {ok, _} = supervisor:start_child(Pid, [?MODULE, worker, []]), io:format("Supervisor started.~n"). worker() -> io:format("Worker process started.~n"), loop(). crash() -> exit(crash). loop() -> receive _ -> loop() end. </pre> == Libraries and Frameworks == Erlang provides a rich ecosystem of libraries and frameworks. Some notable ones include: * [[Erlang/OTP]]: The Erlang/OTP platform provides a comprehensive set of libraries, tools, and design principles to build scalable and fault-tolerant systems. * [[Cowboy (web server)|Cowboy]]: A small, fast, and modern HTTP server for Erlang/OTP, suitable for building web applications and RESTful APIs. * [[Riak]]: A distributed NoSQL database written in Erlang, designed to handle large-scale, fault-tolerant applications. * [[Elixir (programming language)|Elixir]]: A dynamic, functional language built on top of Erlang that brings a more approachable syntax and powerful metaprogramming capabilities to the Erlang ecosystem. == See also == * [[Erlang processes]] * [[Supervisor (Erlang)]] * [[Elixir (programming language)]] * [[Functional programming]] == References == {{reflist}} [[Category:Programming languages]] [[Category:Concurrent programming]] [[Category:Functional languages]] [[Category:Fault-tolerant computing]]
Summary:
Please note that all contributions to Elixir Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Elixir Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Template:Reflist
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information