• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Erlang
 

Erlang

on

  • 838 views

 

Statistics

Views

Total Views
838
Views on SlideShare
829
Embed Views
9

Actions

Likes
0
Downloads
3
Comments
1

1 Embed 9

http://applicake.com 9

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • uhh.. Erlang is NOT based on Prolog!
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Erlang Erlang Presentation Transcript

    • Erlang – What is it?- created by Joe Armstrong in 1986 at Ericcsson Telecom - based on Prolog - functional language - dynamicly typed Author: Mateusz Zawisza
    • Where is it used? - RabbitMQ (France Telecom) - Facebook Chat - GitHub (egitd) - SampleDB (AWS) Author: Mateusz Zawisza
    • Types - variablesVar = 2.Var. %=> 2Var = 3. % this throws an error! Author: Mateusz Zawisza
    • Types - atoms - same role as symbols in Ruby - usually start with lower-casethis_is_atom Author: Mateusz Zawisza
    • Types - lists[1, 2, 3, 4] Author: Mateusz Zawisza
    • Types - tuples{a, 2,"d"}.{ company, {name, "Applicake", {address, "Krakow"} }}. Author: Mateusz Zawisza
    • MatchingCompany = {company, {name, "Applicake"}, {address, "Krakow"}}.{company, {name, Name}, {address, Address}} = Company.Name %=> "Applicake"Address %=> "Krakow" Author: Mateusz Zawisza
    • Matching[Head | Tail] = [1,2,3,4].Head. %=> 1Tail. %=> [2,3,4] Author: Mateusz Zawisza
    • Matching[One, Two | Rest] = [1,2,3,4].One. %=> 1Two. %=> 2Rest.%=> [3,4] Author: Mateusz Zawisza
    • Functions -module(mirror_function). -export([mirror/1]).mirror(Argument) -> Argument. Author: Mateusz Zawisza
    • Functions-module(matching_function). -export([number/1]). number(one) -> 1; number(two) -> 2; number(three) -> 3. Author: Mateusz Zawisza
    • FunctionsNumbers = [1,2,3,4].lists:map(fun(X) -> X+1 end, Numbers).%=> [2,3,4,5] Author: Mateusz Zawisza
    • Functionsmap(F, [H|T]) -> [F(H) | map(F, T)];map(F, []) -> []. Author: Mateusz Zawisza
    • Control sturctures... case...case Animal of "dog" -> underdoga; "cat" -> thundercat _ -> something_elseend. Author: Mateusz Zawisza
    • Control sturctures... if...if X > 0 -> positive; X < 0 -> negative; true -> zeroend. Author: Mateusz Zawisza
    • ProcessesPid = spawn(fun module_name:function_name/0).Pid ! "message". Author: Mateusz Zawisza
    • Processesfuction_name() -> receive "message" -> io:format("Hi!"), function_name(); _ -> io:format("Whatever..."), function_name()end. Author: Mateusz Zawisza