Erlang crash course CiA Oslo 2012

573 views

Published on

Crash course in Erlang, lightning talk

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
573
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
41
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Erlang crash course CiA Oslo 2012

  1. 1. Crash course in Erlang Erlang in 15 minutes Page 1 Baksia CiA2012 Erlang , 09.02.12
  2. 2. " Erlang • The world is concurrent • Things in the world don't share data • Things communicate with messages • Things fail - Joe Armstrong Page 2 Baksia CiA2012 Erlang , 09.02.12
  3. 3. " What is Erlang • Created and maintained by Ericsson (now open source) • Functional, single assignment, strict evaluation, dynamic typing • Actor model, concurrent oriented, fault tolerant, soft-realtime • Light weight processes that communicate using message passing (an Erlang process is more light weight than a Java thread) • Erlang started life as a modified prolog • Erlang shell, escript and compiled .beam bytecode Page 3 Baksia CiA2012 Erlang , 09.02.12
  4. 4. " Atoms and tuples • An atom is a global constant starting with lower case • A tuple is an ordered set of elements • Your Java or C# class would be a tuple with an atom identifier Page 4 Baksia CiA2012 Erlang , 09.02.12
  5. 5. " Erlang processes • Erlang is designed for massive concurrency. Erlang processes are light-weight (grow and shrink dynamically) with small memory footprint, fast to create and terminate and the scheduling overhead is low. • A process is created by calling spawn • Spawn returns a process Id PID in which you can send messages to with the bang ! sign Page 5 Baksia CiA2012 Erlang , 09.02.12
  6. 6. " The *Real* Erlang "Hello, World!" h"p://egarson.blogspot.com/2008/03/real-­‐erlang-­‐hello-­‐world.html   Page 6 Baksia CiA2012 Erlang , 09.02.12
  7. 7. " Pattern matching Page 7 Baksia CiA2012 Erlang , 09.02.12
  8. 8. " Variables and pattern matching Page 8 Baksia CiA2012 Erlang , 09.02.12
  9. 9. " Actors and pattern matching Page 9 Baksia CiA2012 Erlang , 09.02.12
  10. 10. " Loops Page 10 Baksia CiA2012 Erlang , 09.02.12
  11. 11. " No while or for loops ? Page 11 Baksia CiA2012 Erlang , 09.02.12
  12. 12. " Tail recursion Page 12 Baksia CiA2012 Erlang , 09.02.12
  13. 13. " Tail optimized recursion  tail  recursion  as  seen  here  is  not  making  the  memory   grow  because  when  the  virtual  machine  sees  a  funcAon   calling  itself  in  a  tail  posiAon  (the  last  expression  to  be   evaluated  in  a  funcAon),  it  eliminates  the  current  stack   frame.     Page 13 Baksia CiA2012 Erlang , 09.02.12
  14. 14. " Changes Page 14 Baksia CiA2012 Erlang , 09.02.12
  15. 15. " BIF Built In Functions • BIFs are functions that are part of the Erlang language • BIFs usually do tasks that are impossible to do in Erlang •  list_to_tuple([22,cat,”text”]). •  spawn(fun() -> my_fun(“Hello”) end). Page 15 Baksia CiA2012 Erlang , 09.02.12
  16. 16. " Learn you some Erlang • Great site • http://learnyousomeerlang.com/ Page 16 Baksia CiA2012 Erlang , 09.02.12
  17. 17. CiA  2012  -­‐  Bridging  the  gaps   8  februar  17:30  –  20:30   Page 17 Baksia CiA2012 Erlang , 09.02.12

×