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

Erlang

on

  • 414 views

 

Statistics

Views

Total Views
414
Views on SlideShare
414
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

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
  • Full Name Full Name Comment goes here.
    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 Telecombased on Prologfunctional languagedynamicly typed
    • Erlang is...reliablehigh concurrent (no threads. light processes)modular
    • Where is it used?RabbitMQ (France telecom)CouchDBFacebook ChatGitHub (egitd)SimpleDB (AWS)
    • Types
    • VariablesVar = 2.Var.%=> 2Var = 3. % this throws an error!
    • atomsthis_is_atom
    • Lists[1,2,3,4]
    • Tuples{a, 2,"d"}.{ company, {name, "Applicake", {address, "Krakow"}}}.
    • MatchingCompany = {company, {name, "Applicake"}, {address, "Krakow"} }.{company, {name, Name, {address, Address}}} = Company.Name %=> "Applicake"Address %=> "Krakow"
    • Matching[Head | Tail] = [1,2,3,4].Head. %=> 1Tail. %=> [2,3,4]
    • Matching[One, Two | Rest] = [1,2,3,4].One. %=> 1Two. %=> 2Rest.%=> [3,4]
    • functions-module(mirror_function).-export([mirror/1]).mirror(Argument) -> Argument.
    • functions-module(matching_function).-export([number/1]).number(one) -> 1;number(two) -> 2;number(three) -> 3.
    • functionsNumbers = [1,2,3,4].lists:map(fun(X) -> X+1 end, Numbers).%=> [2,3,4,5]
    • functionsmap(F, [H|T]) -> [F(H) | map(F, T)];map(F, []) -> [].
    • Control structures case...case Animal of "dog" -> underdoga; "cat" -> thundercat _ -> something_elseend.
    • Control structures if...if X > 0 -> positive; X < 0 -> negative; true -> zeroend.
    • Processes
    • ProcessesPid = spawn(fun module_name:function_name/0).Pid ! "message".
    • Processesfuction_name() -> receive "message" -> io::format("Hi!"), function_name(); _ -> io::format("Whatever..."), function_name()end.