<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[gen_event:start_link().]]></title>
  <link href="http://blog.netris.eu/atom.xml" rel="self"/>
  <link href="http://blog.netris.eu/"/>
  <updated>2014-09-25T01:11:47+02:00</updated>
  <id>http://blog.netris.eu/</id>
  <author>
    <name><![CDATA[mnemonic]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Erlang/OTP 17 has been released]]></title>
    <link href="http://blog.netris.eu/blog/2014/04/08/erlang-slash-otp-17-has-been-released/"/>
    <updated>2014-04-08T23:19:00+02:00</updated>
    <id>http://blog.netris.eu/blog/2014/04/08/erlang-slash-otp-17-has-been-released</id>
    <content type="html"><![CDATA[<p>No, it is not a versioning error &#8230; the Erlang usual <code>Rn[A|B](-p)</code> release format is now over &#8230; long life to the new <code>R(.p)</code> release format !</p>

<p>This new version bring us interesting changes including language changes:</p>

<ul>
<li>EEP43: A new data type called <code>Maps</code>, for example:</li>
</ul>


<pre>
$ erl
Erlang/OTP 17 [erts-6.0] [source-07b8f44] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V6.0  (abort with ^G)
1> M = maps:new().
#{}
2> N = M#{"user" => "mnemonic", "age" => "31"}.
#{"age" => "31","user" => "mnemonic"}
3> #{"user" := User, "age" := Age} = N. %% extract value of the keys "user" and "age"
#{"age" => "31","user" => "mnemonic"}
4> User.
"mnemonic"
5> Age.
"31"
</pre>


<ul>
<li>Erlang/OTP has been ported to the realtime operating system OSE.</li>
<li>The <code>{active, N}</code> socket option for TCP, UDP, and SCTP where N is an integer in the range -32768..32767, to allow a caller to specify the number of data messages to be delivered to the controlling process.</li>
<li>A new scheduler utilization balancing mechanism has been introduced. For more information see the <code>+sub</code> command line argument.</li>
<li>Migration of memory carriers has been enabled by default on all ERTS internal memory allocators based on the <code>alloc_util</code> framework except for <code>temp_alloc</code>.</li>
<li>Increased garbage collection tenure rate.</li>
<li>Erlang &#8220;dirty schedulers&#8221; (experimental). In order to try the functionality out, you need to pass the command line argument <code>--enable-dirty-schedulers</code> to configure when building the system.</li>
<li>EEP37: Funs can now be given names.</li>
</ul>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Erlang processes and message passing]]></title>
    <link href="http://blog.netris.eu/blog/2013/02/01/erlang-processes-and-message-passing/"/>
    <updated>2013-02-01T15:25:00+01:00</updated>
    <id>http://blog.netris.eu/blog/2013/02/01/erlang-processes-and-message-passing</id>
    <content type="html"><![CDATA[<p>A colleague of mine who is very motivated to learn Erlang asked me what are Erlang messages and how to create and use them ?</p>

<p>Let me explain it:</p>

<p>Erlang has been designed for massive concurrency, so Erlang processes are light-weight with a very small memory footprint (in the example bellow a <code>child/0</code> process costs 2656 bytes on a multi-core 64-bit computer), fast to create and terminate and the scheduling overhead is low. In Erlang, processes shares nothing and exchange data through messages. You can create millions of processes inside the Erlang VM because the Erlang VM will not create millions of threads but it will assign each process to a process scheduler, for example if your computer has 8 processor cores, Erlang will create at least 8 process schedulers (in fact one operating system thread per processor core plus some I/O threads).</p>

<figure class='code'><figcaption><span>message.erl </span><a href='https://github.com/rbenaley/erlang_samples/blob/master/message.erl'>link</a></figcaption> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
</pre></td><td class='code'><pre><code class='erlang'><span class='line'><span class="c">%% 1&gt; c(message).</span>
</span><span class='line'><span class="c">%% 2&gt; Pid = spawn(message,child,[]).</span>
</span><span class='line'><span class="c">%% 3&gt; Pid ! hello.</span>
</span><span class='line'>
</span><span class='line'><span class="p">-</span><span class="ni">module</span><span class="p">(</span><span class="n">message</span><span class="p">).</span>
</span><span class='line'><span class="p">-</span><span class="ni">export</span><span class="p">([</span><span class="n">child</span><span class="o">/</span><span class="mi">0</span><span class="p">]).</span>
</span><span class='line'>
</span><span class='line'><span class="nf">child</span><span class="p">()</span> <span class="o">-&gt;</span>
</span><span class='line'>    <span class="k">receive</span>
</span><span class='line'>        <span class="n">hello</span> <span class="o">-&gt;</span>
</span><span class='line'>            <span class="nn">io</span><span class="p">:</span><span class="n">format</span><span class="p">(</span><span class="s">&quot;Hello man !</span><span class="si">~n</span><span class="s">&quot;</span><span class="p">,</span> <span class="p">[]),</span>
</span><span class='line'>            <span class="n">child</span><span class="p">();</span>
</span><span class='line'>        <span class="n">fuck</span> <span class="o">-&gt;</span>
</span><span class='line'>            <span class="nn">io</span><span class="p">:</span><span class="n">format</span><span class="p">(</span><span class="s">&quot;You&#39;re a genuine asshole man !</span><span class="si">~n</span><span class="s">&quot;</span><span class="p">,</span> <span class="p">[]),</span>
</span><span class='line'>            <span class="n">child</span><span class="p">();</span>
</span><span class='line'>        <span class="n">who_are_u</span> <span class="o">-&gt;</span>
</span><span class='line'>            <span class="nn">io</span><span class="p">:</span><span class="n">format</span><span class="p">(</span><span class="s">&quot;My unique process identifier is </span><span class="si">~w~n</span><span class="s">&quot;</span><span class="p">,</span> <span class="p">[</span><span class="n">self</span><span class="p">()]),</span>
</span><span class='line'>            <span class="n">child</span><span class="p">();</span>
</span><span class='line'>        <span class="n">stop</span> <span class="o">-&gt;</span>
</span><span class='line'>            <span class="n">true</span>
</span><span class='line'>    <span class="k">end</span><span class="p">.</span>
</span></code></pre></td></tr></table></div></figure>


<p>Let try it:</p>

<pre>
$ erl
Erlang R16A (erts-5.10) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10  (abort with ^G)
1> P = spawn(message,child,[]).
<0.35.0>
2> processes().
[<0.0.0>,<0.3.0>,<0.6.0>,<0.7.0>,<0.9.0>,<0.10.0>,<0.11.0>,
 <0.12.0>,<0.13.0>,<0.14.0>,<0.15.0>,<0.16.0>,<0.18.0>,
 <0.19.0>,<0.20.0>,<0.21.0>,<0.22.0>,<0.23.0>,<0.24.0>,
 <0.25.0>,<0.26.0>,<0.27.0>,<0.28.0>,<0.29.0>,<0.33.0>,
 <0.35.0>]
3> P ! hello.
Hello man !
hello
4> P ! fuck.
You're a genuine asshole man !
fuck
5> P ! who_are_u.
My unique process identifier is <0.35.0>
who_are_u
6> {_,Size} = process_info(P, memory).
{memory,2656}
7> P ! stop.
stop
8> processes().
[<0.0.0>,<0.3.0>,<0.6.0>,<0.7.0>,<0.9.0>,<0.10.0>,<0.11.0>,
 <0.12.0>,<0.13.0>,<0.14.0>,<0.15.0>,<0.16.0>,<0.18.0>,
 <0.19.0>,<0.20.0>,<0.21.0>,<0.22.0>,<0.23.0>,<0.24.0>,
 <0.25.0>,<0.26.0>,<0.27.0>,<0.28.0>,<0.29.0>,<0.33.0>]
9> P ! hello.
hello
</pre>


<p>As you can see, I created a new process and assigned it to the <code>P</code> variable, its PID was <code>&lt;0.35.0&gt;</code> and it answered to all messages I sent to it (pattern matching of messages received in process mailbox). As I told, it costs 2656 bytes and when I sent the atom <code>stop</code> the process died. As result it is no longer shown via <code>erlang:processes/0</code> and there is no answer to the last message I sent to its PID.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Erlang/OTP R16A has been released]]></title>
    <link href="http://blog.netris.eu/blog/2013/01/30/erlang-slash-otp-r16a-has-been-released/"/>
    <updated>2013-01-30T17:38:00+01:00</updated>
    <id>http://blog.netris.eu/blog/2013/01/30/erlang-slash-otp-r16a-has-been-released</id>
    <content type="html"><![CDATA[<p>Erlang/OTP R16 is a new major release with a number of new features, characteristics and also some minor incompatibilities.</p>

<p>Some remarkable improvements having a huge effect on scalability:</p>

<ul>
<li>New internal process table implementation allowing for both parallel reads as well as writes. Especially read operations have become really cheap. This reduce contention in various situations. For example when, spawning processes, terminating processes, sending messages, creating ports, terminating, ports, etc.</li>
<li>Optimizations of run queue management reducing contention.</li>
<li>Optimizations of process state changes reducing contention.</li>
<li>Non-blocking code loading. Earlier when an Erlang module was loaded, all other execution in the VM were halted while the load operation was carried out in single threaded mode. Now modules are loaded without blocking the VM. Processes may continue executing undisturbed in parallel during the entire load operation. The load operation is completed by making the loaded code visible to all processes in a consistent way with one single atomic instruction. Non-blocking code loading will improve realtime characteristics when modules are loaded/upgraded on a running multi-core system.</li>
<li>Dynamic allocation of port structures. This allow for a much larger maximum amount of ports allowed as a default. The previous default of 1024 has been raised to 65536.</li>
<li>Major rewrite of scheduling of port tasks. Major benefits of the rewrite are reduced contention on run queue locks, and reduced amount of memory allocation operations needed. The rewrite was also necessary in order to make it possible to schedule signals from processes to ports.</li>
<li>Rewrite of all process to port signal implementations in order to make it possible to schedule those operations. All port operations can now be scheduled which allows for reduced lock contention on the port lock as well as truly asynchronous communication with ports. The previous implementation of the VM has delivered signals from processes to ports in a synchronous stricter fashion than required by the language. As of Erlang R16, signals are truly asynchronously delivered.</li>
<li>The runtime system will now by default use 10 async threads if thread support has been enabled when building the runtime system. This will prevent long blocking file-operations from blocking scheduler threads for long periods of time, which can be harmful. Apart from file-operations, it also effects other operations scheduled on the async thread pool by user implemented drivers. Multiple concurrent accesses to different files have the potential of an increased throughput.</li>
</ul>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Erlang Unit Testing]]></title>
    <link href="http://blog.netris.eu/blog/2013/01/29/erlang-unit-testing/"/>
    <updated>2013-01-29T10:39:00+01:00</updated>
    <id>http://blog.netris.eu/blog/2013/01/29/erlang-unit-testing</id>
    <content type="html"><![CDATA[<p>Here is the implementation of a function <code>absolute/1</code> which simply computes the absolute value of a number using pattern matching similarly to the Erlang BIF <code>erlang:abs/1</code>:</p>

<figure class='code'><figcaption><span>num.erl  </span></figcaption>
 <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class='erlang'><span class='line'><span class="p">-</span><span class="ni">module</span><span class="p">(</span><span class="n">num</span><span class="p">).</span>
</span><span class='line'><span class="p">-</span><span class="ni">export</span><span class="p">([</span><span class="n">absolute</span><span class="o">/</span><span class="mi">1</span><span class="p">]).</span>
</span><span class='line'>
</span><span class='line'><span class="nf">absolute</span><span class="p">(</span><span class="nv">Number</span><span class="p">)</span> <span class="k">when</span> <span class="nv">Number</span> <span class="o">&lt;</span> <span class="mi">0</span> <span class="o">-&gt;</span> <span class="o">-</span><span class="nv">Number</span><span class="p">;</span>
</span><span class='line'><span class="nf">absolute</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="mi">0</span><span class="p">;</span>
</span><span class='line'><span class="nf">absolute</span><span class="p">(</span><span class="nv">Number</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nv">Number</span><span class="p">.</span>
</span></code></pre></td></tr></table></div></figure>


<p>It is very simple to understand: the pattern matching processor scans each clause of <code>absolute/1</code> in the order they are declared, when a clause match then the pattern matching processor selects it and immediately executes the corresponding path of the function.</p>

<p>Now we want to check if the function <code>absolute/1</code> works as expected by writing a unit test using the EUnit framework included in the Erlang/OTP distribution :</p>

<figure class='code'><figcaption><span>num_test.erl  </span></figcaption>
 <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
</pre></td><td class='code'><pre><code class='erlang'><span class='line'><span class="p">-</span><span class="ni">module</span><span class="p">(</span><span class="n">num_test</span><span class="p">).</span>
</span><span class='line'><span class="p">-</span><span class="ni">include_lib</span><span class="p">(</span><span class="s">&quot;eunit/include/eunit.hrl&quot;</span><span class="p">).</span>
</span><span class='line'><span class="p">-</span><span class="ni">import</span><span class="p">(</span><span class="n">num</span><span class="p">,</span> <span class="p">[</span><span class="n">absolute</span><span class="o">/</span><span class="mi">1</span><span class="p">]).</span>
</span><span class='line'>
</span><span class='line'><span class="c">%% callable via num_test:test().</span>
</span><span class='line'><span class="nf">absolute_test_</span><span class="p">()</span> <span class="o">-&gt;</span>
</span><span class='line'>    <span class="p">[</span><span class="o">?</span><span class="p">_</span><span class="n">assert</span><span class="p">(</span><span class="n">absolute</span><span class="p">(</span><span class="o">-</span><span class="mi">10</span><span class="p">)</span> <span class="o">==</span> <span class="mi">10</span><span class="p">),</span>
</span><span class='line'>     <span class="o">?</span><span class="p">_</span><span class="n">assert</span><span class="p">(</span><span class="n">absolute</span><span class="p">(</span><span class="o">-</span><span class="mi">5</span><span class="p">)</span> <span class="o">==</span> <span class="mi">5</span><span class="p">),</span>
</span><span class='line'>     <span class="o">?</span><span class="p">_</span><span class="n">assert</span><span class="p">(</span><span class="n">absolute</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">),</span>
</span><span class='line'>     <span class="o">?</span><span class="p">_</span><span class="n">assert</span><span class="p">(</span><span class="n">absolute</span><span class="p">(</span><span class="o">-</span><span class="mi">0</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">),</span>
</span><span class='line'>     <span class="o">?</span><span class="p">_</span><span class="n">assert</span><span class="p">(</span><span class="n">absolute</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">),</span>
</span><span class='line'>     <span class="o">?</span><span class="p">_</span><span class="n">assert</span><span class="p">(</span><span class="n">absolute</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">),</span>
</span><span class='line'>     <span class="o">?</span><span class="p">_</span><span class="n">assert</span><span class="p">(</span><span class="n">absolute</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span> <span class="o">==</span> <span class="mi">5</span><span class="p">),</span>
</span><span class='line'>     <span class="o">?</span><span class="p">_</span><span class="n">assert</span><span class="p">(</span><span class="n">absolute</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span> <span class="o">==</span> <span class="mi">10</span><span class="p">)].</span>
</span></code></pre></td></tr></table></div></figure>


<p>Then we invoke <code>num_test:test()</code> in the Erlang runtime system:</p>

<pre>
$ erl
Erlang R16A (erts-5.10) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V5.10  (abort with ^G)
1> num_test:test().
  All 8 tests passed.
ok
</pre>


<p>All tests passed successfully.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[The actor model is 40 years old]]></title>
    <link href="http://blog.netris.eu/blog/2013/01/26/the-actor-model-is-40-years-old/"/>
    <updated>2013-01-26T00:49:00+01:00</updated>
    <id>http://blog.netris.eu/blog/2013/01/26/the-actor-model-is-40-years-old</id>
    <content type="html"><![CDATA[<p>Yes believe it or not, the Actor model is forty years old. It has been invented in 1973 by Carl Hewitt and published in a paper authored by Carl Hewitt, Peter Bishop, and Richard Steiger.</p>

<blockquote><p>The Actor model in computer science is a mathematical model of concurrent computation that treats &#8220;actors&#8221; as the universal primitives of concurrent digital computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received.</p><p>Decoupling the sender from communications sent was a fundamental advance of the Actor model enabling asynchronous communication and control structures as patterns of passing messages.</p><p>Recipients of messages are identified by address, sometimes called &#8220;mailing address&#8221;. Thus an actor can only communicate with actors whose addresses it has. It can obtain those from a message it receives, or if the address is for an actor it has itself created.</p><p>The Actor model is characterized by inherent concurrency of computation within and among actors, dynamic creation of actors, inclusion of actor addresses in messages, and interaction only through direct asynchronous message passing with no restriction on message arrival order.</p><footer><strong>Wikipedia</strong> <cite>The Free Encyclopedia</cite></footer></blockquote>


<p>So it is time to wake up computer programmers ! Stop wasting time with threads and synchronization resulting in esoteric bugs like race conditions and dead-locks, even if you are able to use threads correctly they are heavyweight, inefficient and consume a lot of memory.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[What is functional programming?]]></title>
    <link href="http://blog.netris.eu/blog/2013/01/25/what-is-functional-programming/"/>
    <updated>2013-01-25T20:10:00+01:00</updated>
    <id>http://blog.netris.eu/blog/2013/01/25/what-is-functional-programming</id>
    <content type="html"><![CDATA[<blockquote><p>In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state.</p><footer><strong>Wikipedia</strong> <cite>The Free Encyclopedia</cite></footer></blockquote>


<p>Sample code:</p>

<figure class='code'><figcaption><span>fibonacci.erl  </span></figcaption>
 <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class='erlang'><span class='line'><span class="p">-</span><span class="ni">module</span><span class="p">(</span><span class="n">fibonacci</span><span class="p">).</span>
</span><span class='line'><span class="p">-</span><span class="ni">export</span><span class="p">([</span><span class="n">fibo</span><span class="o">/</span><span class="mi">1</span><span class="p">]).</span>
</span><span class='line'>
</span><span class='line'><span class="nf">fibo</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="mi">0</span><span class="p">;</span>
</span><span class='line'><span class="nf">fibo</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="mi">1</span><span class="p">;</span>
</span><span class='line'><span class="nf">fibo</span><span class="p">(</span><span class="nv">N</span><span class="p">)</span> <span class="k">when</span> <span class="nv">N</span> <span class="o">&gt;</span> <span class="mi">1</span> <span class="o">-&gt;</span> <span class="n">fibo</span><span class="p">(</span><span class="nv">N</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="n">fibo</span><span class="p">(</span><span class="nv">N</span><span class="o">-</span><span class="mi">2</span><span class="p">).</span>
</span></code></pre></td></tr></table></div></figure>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Just for fun: wanna load your computer ?]]></title>
    <link href="http://blog.netris.eu/blog/2012/09/21/just-for-fun-wanna-load-your-computer/"/>
    <updated>2012-09-21T00:22:00+02:00</updated>
    <id>http://blog.netris.eu/blog/2012/09/21/just-for-fun-wanna-load-your-computer</id>
    <content type="html"><![CDATA[<p>Don&#8217;t forget to start the Erlang runtime system with a maximum number of concurrent processes sufficiently high, eg. <code>erl +P 100000000</code>.</p>

<p>Of course, be sure it will finish to crash &#8230;</p>

<figure class='code'><figcaption><span>smp_load.erl </span><a href='https://github.com/rbenaley/erlang_samples/blob/master/smp_load.erl'>link</a></figcaption> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
</pre></td><td class='code'><pre><code class='erlang'><span class='line'><span class="c">%% 1&gt; c(smp_load).</span>
</span><span class='line'><span class="c">%% 2&gt; smp_load:start().</span>
</span><span class='line'>
</span><span class='line'><span class="p">-</span><span class="ni">module</span><span class="p">(</span><span class="n">smp_load</span><span class="p">).</span>
</span><span class='line'><span class="p">-</span><span class="ni">export</span><span class="p">([</span><span class="n">start</span><span class="o">/</span><span class="mi">0</span><span class="p">]).</span>
</span><span class='line'>
</span><span class='line'><span class="nf">fx</span><span class="p">(</span><span class="nv">X</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="o">-&gt;</span>
</span><span class='line'>    <span class="nv">X</span><span class="p">;</span>
</span><span class='line'><span class="nf">fx</span><span class="p">(</span><span class="nv">X</span><span class="p">,</span> <span class="nv">Y</span><span class="p">)</span> <span class="o">-&gt;</span>
</span><span class='line'>    <span class="p">_</span> <span class="o">=</span> <span class="nv">X</span> <span class="ow">bxor</span> <span class="nv">Y</span><span class="p">,</span>
</span><span class='line'>    <span class="n">fx</span><span class="p">(</span><span class="nv">X</span><span class="o">*</span><span class="nv">Y</span><span class="p">,</span> <span class="nv">Y</span><span class="o">-</span><span class="mi">1</span><span class="p">).</span>
</span><span class='line'>
</span><span class='line'><span class="nf">start</span><span class="p">()</span> <span class="o">-&gt;</span>
</span><span class='line'>    <span class="nb">spawn</span><span class="p">(</span><span class="k">fun</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="n">fx</span><span class="p">(</span><span class="mi">16#FF</span><span class="p">,</span> <span class="mi">16#FFFF</span><span class="p">)</span> <span class="k">end</span><span class="p">),</span>
</span><span class='line'>    <span class="n">start</span><span class="p">().</span>
</span></code></pre></td></tr></table></div></figure>



]]></content>
  </entry>
  
</feed>
