summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-05-10 17:20:10 +0200
committerGuido Günther <agx@sigxcpu.org>2016-05-10 17:20:10 +0200
commit7910e2910daa33af41cef729dcf2408a106473de (patch)
treeb531d45766cafb9846cfc5ad8e0d6e121da38cb5
parent54ba43b15f6875e1d65ebed772c5dd678bb4752c (diff)
Add html version
-rw-r--r--erlang.html415
1 files changed, 415 insertions, 0 deletions
diff --git a/erlang.html b/erlang.html
new file mode 100644
index 0000000..d363274
--- /dev/null
+++ b/erlang.html
@@ -0,0 +1,415 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta name="generator" content="pandoc">
+ <meta name="author" content="Guido Günther">
+ <meta name="dcterms.date" content="2016-05-09">
+ <title>Wissenswertes über Erlang</title>
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
+ <link rel="stylesheet" href="reveal.js/css/reveal.css"/>
+ <style type="text/css">code{white-space: pre;}</style>
+ <link rel="stylesheet" href="reveal.js/css/theme/black.css" id="theme">
+ <!-- Printing and PDF exports -->
+ <script>
+ var link = document.createElement( 'link' );
+ link.rel = 'stylesheet';
+ link.type = 'text/css';
+ link.href = window.location.search.match( /print-pdf/gi ) ? 'reveal.js/css/print/pdf.css' : 'reveal.js/css/print/paper.css';
+ document.getElementsByTagName( 'head' )[0].appendChild( link );
+ </script>
+ <!--[if lt IE 9]>
+ <script src="reveal.js/lib/js/html5shiv.js"></script>
+ <![endif]-->
+</head>
+<body>
+ <div class="reveal">
+ <div class="slides">
+
+<section>
+ <h1 class="title">Wissenswertes über Erlang</h1>
+ <h2 class="author">Guido Günther</h2>
+ <h3 class="date">2016-05-09</h3>
+</section>
+
+<section id="who-am-i" class="slide level1">
+<h1>Who am I</h1>
+<ul>
+<li>Free Software Hacker (Freelancing Software Developer)</li>
+<li>Debian Developer since 2000</li>
+<li>Contributed to libvirt-*, X11, Linux Kernel, GNOME, Calypso, …</li>
+<li>FSFE Fellow and GNOME Foundation member</li>
+<li>Rather new to Erlang</li>
+</ul>
+</section>
+<section id="erl-what" class="slide level1">
+<h1>Erl-what?</h1>
+<ul>
+<li>Developed at Ericsson in 1986</li>
+<li>Open sourced 1998</li>
+<li>Ericsson Language or Agner Krarup Erlang?</li>
+<li><p>For telephone systems</p></li>
+<li>Functional, concurrent programming language</li>
+<li>Garbage collected runtime system</li>
+<li><p>Erlang/OTP</p></li>
+</ul>
+</section>
+<section id="erlang-features" class="slide level1">
+<h1>Erlang, Features</h1>
+<ul>
+<li>Fault tolerant</li>
+<li>Hot code replacements</li>
+<li>Distributed</li>
+<li>highly available - 12 years of uptime - nine 9s (30 ms / a)</li>
+</ul>
+</section>
+<section id="projects" class="slide level1">
+<h1>Projects</h1>
+<ul>
+<li>ejabberd, Riak, CouchDB, RabbitMQ</li>
+<li>WhatsApp, GitHub, Facebook, …</li>
+</ul>
+</section>
+<section id="you-lack-style---no-state" class="slide level1">
+<h1>You lack style - no, state!</h1>
+</section>
+<section class="slide level1">
+
+<h2 id="functional-language">Functional language</h2>
+<p>f(x) = y</p>
+</section>
+<section class="slide level1">
+
+<p>i = i + 3</p>
+</section>
+<section class="slide level1">
+
+<p><del>i = i + 3</del></p>
+</section>
+<section class="slide level1">
+
+<p>for (int i=0; i &lt; 3; i++) do_something(i);</p>
+</section>
+<section class="slide level1">
+
+<p><del>for (int i=0; i &lt; 3; i++) do_something(i);</del></p>
+</section>
+<section class="slide level1">
+
+<pre><code>1&gt; A=3.
+3
+2&gt; A=4.
+** exception error: no match of right hand side value 4</code></pre>
+</section>
+<section class="slide level1">
+
+<h2 id="no-means-no">No means No</h2>
+<ul>
+<li>No imperative programming</li>
+<li>No global variables and state</li>
+<li>No pointers</li>
+<li>No variable reassignments</li>
+</ul>
+</section>
+<section class="slide level1">
+
+<ul>
+<li>Yes, Higher Order Functions</li>
+<li>Yes, Pattern Matching</li>
+<li>Yes, Code Reloads</li>
+<li>Yes, Lots of independent Processes</li>
+</ul>
+</section>
+<section class="slide level1">
+
+<h2 id="recursion-to-the-rescue">Recursion to the Rescue</h2>
+<pre><code>loop(X) -&gt; loop(X, 0).
+
+loop(X=0, Sum) -&gt; Sum;
+loop(X, Sum) -&gt; loop(X-1, Sum+X).</code></pre>
+</section>
+<section class="slide level1">
+
+<h2 id="recursion-in-detail">Recursion in Detail</h2>
+<pre><code>loop(3) -&gt; loop(3, 0)
+loop(3,0) -&gt; loop(3-1, 0+3)
+loop(2,3) -&gt; loop(2-1, 3+2)
+loop(1,5) -&gt; loop(1-1, 5+1)
+loop(0,6) -&gt; 6
+
+3 + 2 + 1 = 6</code></pre>
+</section>
+<section class="slide level1">
+
+<h2 id="head-to-wall-tail">Head to <del>Wall</del> Tail</h2>
+<pre><code>A = [this, is, a, list].
+[H|T] = A.</code></pre>
+</section>
+<section class="slide level1">
+
+<pre><code>rev(L) -&gt; rev(L, []).
+
+rev([], N) -&gt; N;
+rev([H|T], N) -&gt; rev(T, [H] ++ N).</code></pre>
+</section>
+<section class="slide level1">
+
+<pre><code>rev([a,b,c,d]) -&gt; rev([a,b,c,d], [])
+
+rev([a|[b,c,d]], []) -&gt; rev([b,c,d], [a] ++ [])
+
+rev([b|[c,d]], [a]) -&gt; rev([c,d], [b] ++ [a])
+
+rev([c|[d]], [b,a]) -&gt; rev([d], [c] ++ [b,a])
+
+rev([d|[], [c,b,a]) -&gt; rev([], [d] ++ [c,b,a])
+
+rev([], [d,c,b,a]) -&gt; [d,c,b,a]</code></pre>
+</section>
+<section class="slide level1">
+
+<h2 id="more-pattern-matching">More pattern matching</h2>
+<pre><code>A = {this, is, a, tuple}.
+{_, _, _, B} = A.</code></pre>
+</section>
+<section class="slide level1">
+
+<pre><code>&gt; B.
+tuple
+&gt; _.
+* 1: variable &#39;_&#39; is unbound</code></pre>
+</section>
+<section class="slide level1">
+
+<h3 id="fun-with-funs">Fun with Funs</h3>
+<pre><code>F = fun (X) -&gt; X*X end.
+&gt; F(3).
+&gt; F(ok).</code></pre>
+</section>
+<section class="slide level1">
+
+<pre><code>&gt; F(3).
+9
+&gt; F(ok).
+** exception error: an error occurred when evaluating an arithmetic expression
+ in operator */2
+ called as ok * ok</code></pre>
+</section>
+<section class="slide level1">
+
+<h2 id="success-typing">Success, Typing!</h2>
+<p>Dialyzer</p>
+<pre><code>-spec foobar(atom()) -&gt; [atom()].
+foobar(App) -&gt; …</code></pre>
+</section>
+<section id="processes-which-processes" class="slide level1">
+<h1>Processes, which Processes</h1>
+</section>
+<section class="slide level1">
+
+<h2 id="spawning-a-process">Spawning a process</h2>
+<pre><code>F = fun(X) -&gt; io:format(&quot;~p~n&quot;, [X]) end.
+times(X, Args, C) -&gt; ...
+
+spawn(l, times, [F, &quot;I&#39;m a process&quot;, 3]).</code></pre>
+</section>
+<section class="slide level1">
+
+<pre><code>spawn(l, times, [F, &quot;I&#39;m a process&quot;, 3]),
+spawn(l, times, [F, &quot;I&#39;m a process too&quot;, 3]).</code></pre>
+</section>
+<section class="slide level1">
+
+<h2 id="concurrency-for-free">Concurrency for free!</h2>
+<pre><code>&quot;I&#39;m a process&quot;
+&quot;I&#39;m a process too&quot;
+&quot;I&#39;m a process&quot;
+&quot;I&#39;m a process too&quot;
+&lt;0.53.0&gt;
+&quot;I&#39;m a process&quot;
+&quot;I&#39;m a process too&quot;</code></pre>
+</section>
+<section class="slide level1">
+
+<h2 id="shared-nothing">Share(d) nothing</h2>
+<pre><code>start_pong(Pid) -&gt; …
+pong(Pid) -&gt; …
+
+&gt; P = l:start_pong(self()).
+&gt; P ! { ping, &quot;foo&quot; }.
+&gt; P ! giveup.</code></pre>
+</section>
+<section class="slide level1">
+
+<pre><code>&gt; R = fun () -&gt; receive M -&gt; M end end.</code></pre>
+</section>
+<section class="slide level1">
+
+<pre><code>&gt; R().
+{pong,&quot;hallo1&quot;}
+&gt; R().
+{pong,&quot;hallo2&quot;}</code></pre>
+</section>
+<section class="slide level1">
+
+<h2 id="let-it-crash">Let it crash</h2>
+<pre><code>2&gt; P ! {ping, 3}.
+{ping,3}
+3&gt;
+=ERROR REPORT==== 8-May-2016::15:13:30 ===
+Error in process &lt;0.34.0&gt; with exit value:
+{badarg,[{io,format,[&lt;0.25.0&gt;,&quot;pong: Received ping &#39;~s&#39;~n&quot;,[3]],[]},
+ {l,pong,1,[{file,&quot;l.erl&quot;},{line,57}]}]}</code></pre>
+</section>
+<section class="slide level1">
+
+<pre><code>2&gt; P ! whatever
+Unknwown message asfasdf, giving up</code></pre>
+</section>
+<section class="slide level1">
+
+<h2 id="linking-processes">Linking processes</h2>
+<pre><code>&gt; process_flag(trap_exit, true).
+&gt; P = l:start_pong2(self()).
+3&gt; P ! sadfsadf.
+Unknwown message sadfsadf, giving upsadfsadf
+4&gt; receive X -&gt; X end.
+{&#39;EXIT&#39;,&lt;0.35.0&gt;,reason}</code></pre>
+</section>
+<section class="slide level1">
+
+<h2 id="distributed-nodes">Distributed nodes</h2>
+<pre><code>$ erl -sname ping
+$ erl -sname pong
+
+register(spawn(...))</code></pre>
+</section>
+<section class="slide level1">
+
+<p>On pong</p>
+<pre><code>&gt; P = l:start_pong3().</code></pre>
+<p>On ping</p>
+<pre><code>&gt; {pong, pong@bogon} ! {ping, &quot;hello&quot;, self()}.
+&gt; {pong, pong@bogon} ! {ping, &quot;hello&quot;, self()}.
+&gt; receive X -&gt; X end.
+{pong,&quot;hello&quot;}</code></pre>
+</section>
+<section class="slide level1">
+
+<pre><code>erlang:node().
+erlang:nodes().</code></pre>
+</section>
+<section class="slide level1">
+
+<h2 id="hot-code-replacements">Hot code replacements</h2>
+<pre><code>version() -&gt; …
+c(l).</code></pre>
+</section>
+<section id="otp" class="slide level1">
+<h1>OTP</h1>
+<p>Open Telecommunication Platform</p>
+</section>
+<section class="slide level1">
+
+<h2 id="batteries-inclued">Batteries inclued</h2>
+<ul>
+<li>EUnit</li>
+<li>Mnesia</li>
+<li>HTTP/SNMP/…</li>
+<li>…</li>
+</ul>
+</section>
+<section class="slide level1">
+
+<h2 id="behaviours">Behaviours</h2>
+<ul>
+<li>gen_{server,fsm,event}</li>
+<li>supervisor</li>
+<li>application</li>
+</ul>
+</section>
+<section id="debugging" class="slide level1">
+<h1>Debugging</h1>
+</section>
+<section class="slide level1">
+
+<h2 id="tracing-processes-messges">Tracing Processes, Messges, …</h2>
+<pre><code>erl -sname observer -hidden -run observer</code></pre>
+</section>
+<section class="slide level1">
+
+<h2 id="tracing-functions">Tracing functions</h2>
+<pre><code>dbg:start().
+dbg:tracer().
+% trace messages (m)
+dbg:p(pong, m). </code></pre>
+</section>
+<section id="the-greater-erlang-universe" class="slide level1">
+<h1>The greater Erlang Universe</h1>
+<ul>
+<li>REST: <a href="https://github.com/webmachine/webmachine">Webmachine</a></li>
+<li>JSON: <a href="https://github.com/davisp/jiffy">jiffy</a></li>
+<li>YAML: <a href="https://github.com/processone/p1_yaml">p1_yaml</a></li>
+<li>Build, run, test: <a href="https://github.com/erlang/rebar3">Rebar3</a></li>
+<li>… your favorite erlang app goes here …</li>
+</ul>
+</section>
+<section id="extending-erlang" class="slide level1">
+<h1>Extending Erlang</h1>
+</section>
+<section class="slide level1">
+
+<h2 id="nifs---gesundheit">NIFs - Gesundheit!</h2>
+<p>Native Implemented Functions</p>
+</section>
+<section class="slide level1">
+
+<h2 id="c-nodes">C-Nodes</h2>
+</section>
+<section id="see-also" class="slide level1">
+<h1>See also</h1>
+<ul>
+<li><a href="http://elixir-lang.org/">Elixir</a></li>
+<li><a href="http://lfe.io/">LFE(Lisp flavored Erlang)</a></li>
+<li><a href="http://erlangonxen.org/">Erlang on Xen</a></li>
+</ul>
+</section>
+<section id="further-reading" class="slide level1">
+<h1>Further Reading</h1>
+<ul>
+<li><a href="http://learnyousomeerlang.com/">Learn you some erlang</a> - buy the book!</li>
+<li>On Debian <a href="">/usr/share/doc/erlang-doc</a></li>
+<li>Everywhere else: https://www.erlang.org/docs</li>
+</ul>
+</section>
+<section id="questions" class="slide level1">
+<h1>Questions?</h1>
+</section>
+ </div>
+ </div>
+
+ <script src="reveal.js/lib/js/head.min.js"></script>
+ <script src="reveal.js/js/reveal.js"></script>
+
+ <script>
+
+ // Full list of configuration options available at:
+ // https://github.com/hakimel/reveal.js#configuration
+ Reveal.initialize({
+ // Vertical centering of slides
+ center: true,
+ // Transition style
+ transition: 'fade', // none/fade/slide/convex/concave/zoom
+
+ // Optional reveal.js plugins
+ dependencies: [
+ { src: 'reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
+ { src: 'reveal.js/plugin/zoom-js/zoom.js', async: true },
+ { src: 'reveal.js/plugin/notes/notes.js', async: true }
+ ]
+ });
+ </script>
+ </body>
+</html>