<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Deftly.net &#187; erlang</title>
	<atom:link href="http://www.deftly.net/tag/erlang/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.deftly.net</link>
	<description>I think this stuff is cool!</description>
	<lastBuildDate>Sat, 12 Jun 2010 23:47:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Concurrent Hello with Erlang</title>
		<link>http://www.deftly.net/2010/03/12/concurrent-hello-with-erlang/</link>
		<comments>http://www.deftly.net/2010/03/12/concurrent-hello-with-erlang/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 23:18:40 +0000</pubDate>
		<dc:creator>Qbit</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[erlang]]></category>

		<guid isPermaLink="false">http://www.deftly.net/?p=14</guid>
		<description><![CDATA[I recently picked up a copy of Joe Armstrong&#8217;s superb Programming Erlang book ( from the folks @ pragprog.com ). While reading the chapter on concurrent programming I was completely stumped by one of the examples. It basically creates a &#8220;server&#8221; and &#8220;client&#8221; and allows for message passing between the two. I found it very [...]]]></description>
			<content:encoded><![CDATA[<p>I recently picked up a copy of Joe Armstrong&#8217;s superb Programming Erlang book ( from the folks @ pragprog.com ).  While reading the chapter on concurrent programming I was completely stumped by one of the examples.  It basically creates a &#8220;server&#8221; and &#8220;client&#8221; and allows for message passing between the two.  I found it very difficult to follow the passing of messages from a to b, and back.</p>
<p>Enter chello.erl!  I created a slightly modified version of Joe&#8217;s example that uses some io:format to tell you what&#8217;s going on.  Hope someone finds this useful.</p>
<hr />
<pre>-module (chello).
-export ([loop/0, rpc/2]).

rpc(Pid, Request) -&gt;
    io:format("rpc[~p]  sending ~p to ~p~n", [self(), Request, Pid]),
    Pid ! {self(), Request},
    receive
            Response -&gt;
                io:format("rpc[~p]  responding with : ~p~n", [self(), Response]),
                {Pid,Response}
    end.

loop() -&gt;
    receive
        {From, {hello}} -&gt;
            io:format("loop[~p] received info from: ~p~n", [self(), From]),
            From ! {self(), "Hello"},
            loop();
        {From, {goodbye}} -&gt;
            io:format("loop[~p] received info from: ~p~n", [self(), From]),
            From ! {self(),"Goodbye"},
            loop();
        {From, Other} -&gt;
            io:format("loop[~p] received info from: ~p~n", [self, From]),
            From ! {self(),{error, Other}},
            loop()
    end.</pre>
<hr />Run with:</p>
<p>1&gt; Pid = spawn(fun chello:loop/0).</p>
<p>&lt;0.38.0&gt;</p>
<p>2&gt; chello:rpc(Pid, {hello}).<br />
rpc[&lt;0.31.0&gt;]  sending {hello} to &lt;0.38.0&gt;</p>
<p>loop[&lt;0.38.0&gt;] received info from: &lt;0.31.0&gt;</p>
<p>rpc[&lt;0.31.0&gt;]  responding with : {&lt;0.38.0&gt;,&#8221;Hello&#8221;}</p>
<p>{&lt;0.38.0&gt;,{&lt;0.38.0&gt;,&#8221;Hello&#8221;}}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.deftly.net/2010/03/12/concurrent-hello-with-erlang/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using VIM to make erlang pretty</title>
		<link>http://www.deftly.net/2010/03/12/using-vim-to-make-erlang-pretty/</link>
		<comments>http://www.deftly.net/2010/03/12/using-vim-to-make-erlang-pretty/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 16:18:52 +0000</pubDate>
		<dc:creator>Qbit</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[erlang]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.deftly.net/?p=6</guid>
		<description><![CDATA[I recently read an article ( Which no longer exists ) talking about purtifying erlang. This inspired me to create a quick function in vim to do this for me! Here it is: function! ErlPretty() silent !erl -noshell -eval 'erl_tidy:file("%",[verbose]).' -s erlang halt endfunction nmap ep :execute ErlPretty() Hopefully someone finds it handy!]]></description>
			<content:encoded><![CDATA[<p>I recently read an <a href="http://blog.tornkvist.org/blog.yaws/?id=1233867602690448" target="_blank">article</a> ( Which no longer exists <img src='http://www.deftly.net/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  ) talking about purtifying erlang. This inspired me to create a quick function in vim to do this for me!<br />
Here it is:</p>
<pre>function! ErlPretty()
    silent !erl -noshell -eval 'erl_tidy:file("%",[verbose]).' -s erlang halt
endfunction
nmap ep :execute ErlPretty()</pre>
<p>Hopefully someone finds it handy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.deftly.net/2010/03/12/using-vim-to-make-erlang-pretty/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
