📎 Webclip
Learn elixir in Y Minutes
Elixir is presented as a modern functional language built on the Erlang VM, compatible with Erlang but using a more standard syntax and offering more features. The page sketches the core data types, operators, control flow forms, module and function definitions, structs, exceptions, and concurrency through processes and message passing.
Reading notes#
- Elixir runs on the Erlang VM and stays compatible with Erlang while using a more standard syntax.
- Comments are single-line only, and the shell uses
iexwhile compilation useselixirc. - Basic types include numbers, atoms, tuples, lists, binaries, strings, char lists, and ranges.
=means pattern matching, not assignment, and many examples depend on matching values against patterns.- Strings are UTF-8 encoded, while char lists are lists.
/returns a float, whiledivandremhandle integer division and remainders.- Boolean operators
or,and, andnotrequire boolean inputs, while||,&&, and!accept any type. - Comparisons include strict variants such as
===and!==, and Elixir defines a total ordering across data types. - Control flow uses
if,unless,case,cond, andtry/catch, withafteravailable intry/catch. - Anonymous functions can have multiple clauses and guards.
- Functions can be grouped into modules, with
deffor public functions anddefpfor private ones. - Modules may use attributes, including built-in attributes like
@moduledocand custom attributes. - Structs extend maps with default values, compile-time guarantees, and polymorphism.
try/rescuehandles exceptions, and exceptions expose a message.- Concurrency is based on the actor model, using spawning, sending, and receiving messages.
- The shell itself is a process, and
selfreturns its pid.
