Functional

programming with

Who am I?

Jørn Ølmheim, SUB Well Planning and Integrity

  • More than 20 years experience
  • Software craftsman
  • Polyglot programmer
  • Data and solution architect D&W, EITA


Elixir basics

Written by Jose Valim in 2011

Elixir is a

  • functional
  • concurrent
  • general-purpose

 

programming language that runs on the
Erlang virtual machine (BEAM).

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.

Repl demo

Installation

https://elixir-lang.org/install.html

Elixir applications

mix

command line tool

hex

package management tool

Live coding example

More Elixir

Tuples

{:ok, "line1\nline2\nline3"}
{"Dave Thomas", "Programming Elixir", 21.50}

Lists

[1, 2, 3]
[:ok, "hello world", 42, [1,2,3]]

Keyword Lists

[{:a, 1}, {:b, 2}, {:c, 3}]
[a: 1, b: 2, c: 3]

Immutability

Supervisors

Protocols

Resources and further reading