erlang (geektalks)
TRANSCRIPT
Welcome to Erlang
cystbearErlanger
Symfony expert
MongoDB adept
OSS doerhttps://twitter.com/1cdecoderhttps://github.com/cystbearhttp://trinity.ck.ua/
HOTCODE 2013
https://twitter.com/5hthttps://synrc.com/
Maxim Sokhatskiy
Time to change something
History
History
https://www.youtube.com/watch?v=xrIjfIjssLE
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
Low level thinking!FunctionalFastRobustExpressive syntaxEndless running appsUpdate code on a flyOwn SchedulerProcesses based architectureSupervisor treeNo shared memory
Pros / Cons
Hey, did you heard about FP?
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/
Performance
http://slides.com/maximsokhatsky/n2o
Scheduler
http://habrahabr.ru/post/128772/http://habrahabr.ru/post/260065/
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>
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
Example
-module(fib).
-export([fib/1]).
fib(0) -> 0;
fib(1) -> 1;
fib(N) -> fib(N - 1) + fib(N - 2).
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).
Example QuickSort
qsort([]) -> [];
qsort([X|Xs]) ->
qsort([Y || Y<-Xs, Y <= X]) ++ [X] ++ qsort([Y || Y<-Xs, Y > X]).
Application Examples
Web SitesRest ServicesVideo StreamingChats
RabbitMQRiak, CouchDB, Hibari, KAI, LeoFS, MnesiaejabberdCowboyWings 3D
PrivatBankGithub Pages / Gist
Companies
Future
Cherkassy –> fprog
https://www.facebook.com/groups/Cherkassy.fprog/