24

Erlang (GeekTalks)

Embed Size (px)

Citation preview

Page 1: Erlang (GeekTalks)
Page 2: Erlang (GeekTalks)

Welcome to Erlang

Page 3: Erlang (GeekTalks)

cystbearErlanger

Symfony expert

MongoDB adept

OSS doerhttps://twitter.com/1cdecoderhttps://github.com/cystbearhttp://trinity.ck.ua/

Page 4: Erlang (GeekTalks)
Page 5: Erlang (GeekTalks)

HOTCODE 2013

https://twitter.com/5hthttps://synrc.com/

Maxim Sokhatskiy

Page 6: Erlang (GeekTalks)

Time to change something

Page 7: Erlang (GeekTalks)

History

Page 9: Erlang (GeekTalks)

Specific use cases

Non OOP paradigm

Naive syntax

No so big community

Lack of libs

Pros / Cons

https://www.erlang-solutions.com/https://synrc.com/https://github.com/tapstershttps://github.com/erlangbureau

Page 10: Erlang (GeekTalks)

Low level thinking!FunctionalFastRobustExpressive syntaxEndless running appsUpdate code on a flyOwn SchedulerProcesses based architectureSupervisor treeNo shared memory

Pros / Cons

Page 11: Erlang (GeekTalks)

Hey, did you heard about FP?

Page 12: Erlang (GeekTalks)

High order functions

Lambda functions

Separation data and functions

Immutable

Lazy

Tail recursion

Algebraic data types

Pattern matching

Functional

https://twitter.com/nikitonskyhttp://tonsky.me/talks/2015-frontendconf/http://tonsky.me/talks/2015-codefest/

Page 13: Erlang (GeekTalks)

Performance

http://slides.com/maximsokhatsky/n2o

Page 14: Erlang (GeekTalks)

Scheduler

http://habrahabr.ru/post/128772/http://habrahabr.ru/post/260065/

Page 15: Erlang (GeekTalks)

Basics

Integer 42 Float 4.2 aka doubleAtom okBinary <<"Erlang-powa">>

Reference #Ref<0.0.0.29>Pid <0.0.42>Port #Port<0.42>Fun #Fun<erl_eval.6.82930912>

Page 16: Erlang (GeekTalks)

Basics2

List [<<42,1,0,90>>, 1, ok]

Tuple {<0.0.16>, 107, 42, ["madness", true]}

we can force lists type and typify turplesnamed tuples =:= records

Page 17: Erlang (GeekTalks)

Example

-module(fib).

-export([fib/1]).

fib(0) -> 0;

fib(1) -> 1;

fib(N) -> fib(N - 1) + fib(N - 2).

Page 18: Erlang (GeekTalks)

Example-module(fib).

-export([fib/1]).

fib(N) when N > 0 -> fib(N, 1, 0, 1).

fib(1, _, _, _) -> 1;

fib(2, _, _, _) -> 1;

fib(N, N, _, Prev) -> Prev;

fib(N, C, Prev2, Prev) -> fib(N, C+1, Prev, Prev2+Prev).

Page 19: Erlang (GeekTalks)

Example QuickSort

qsort([]) -> [];

qsort([X|Xs]) ->

qsort([Y || Y<-Xs, Y <= X]) ++ [X] ++ qsort([Y || Y<-Xs, Y > X]).

Page 20: Erlang (GeekTalks)

Application Examples

Web SitesRest ServicesVideo StreamingChats

RabbitMQRiak, CouchDB, Hibari, KAI, LeoFS, MnesiaejabberdCowboyWings 3D

PrivatBankGithub Pages / Gist

Page 21: Erlang (GeekTalks)

Companies

Page 22: Erlang (GeekTalks)

Future

Page 23: Erlang (GeekTalks)

Cherkassy –> fprog

https://www.facebook.com/groups/Cherkassy.fprog/

Page 24: Erlang (GeekTalks)