Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Welcome to Erlang

Welcome to Erlang

My First Erlang talk dedicated to beginners

Oleg Zinchenko

June 25, 2015
Tweet

More Decks by Oleg Zinchenko

Other Decks in Programming

Transcript

  1. 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/tapsters https://github.com/erlangbureau
  2. Low level thinking! Functional Fast Robust Expressive syntax Endless running

    apps Update code on a fly Own Scheduler Processes based architecture Supervisor tree No shared memory Pros / Cons
  3. High order functions Lambda functions Separation data and functions Immutable

    Lazy Tail recursion Algebraic data types Pattern matching Functional https://twitter.com/nikitonsky http://tonsky.me/talks/2015-frontendconf/ http://tonsky.me/talks/2015-codefest/
  4. Basics Integer 42 Float 4.2 aka double Atom ok Binary

    <<"Erlang-powa">> Reference #Ref<0.0.0.29> Pid <0.0.42> Port #Port<0.42> Fun #Fun<erl_eval.6.82930912>
  5. Basics2 List [<<42,1,0,90>>, 1, ok] Tuple {<0.0.16>, 107, 42, ["madness",

    true]} we can force lists type and typify turples named tuples =:= records
  6. Example tail_fib(N)-> tail_fib(N, 0, 0, 0). tail_fib(N, Acc, Prev, PrevPrev)

    -> case Acc of N -> Prev + PrevPrev; 0 -> tail_fib(N, Acc + 1, 0, 0); 1 -> tail_fib(N, Acc + 1, 1, 0); _ -> tail_fib(N, Acc + 1, Prev + PrevPrev, Prev) end.
  7. Example QuickSort qsort([]) -> []; qsort([X|Xs]) -> qsort([Y || Y<-Xs,

    Y <= X]) ++ [X] ++ qsort([Y || Y<-Xs, Y > X]).
  8. Application Examples Web Sites Rest Services Video Streaming Chats RabbitMQ

    Riak, CouchDB, Hibari, KAI, LeoFS, Mnesia ejabberd Cowboy Wings 3D PrivatBank Github Pages / Gist