<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7237281566556306193</id><updated>2011-11-28T07:55:51.620+07:00</updated><category term='Erlang Programming'/><category term='Erlang'/><title type='text'>Ivan Darmawan</title><subtitle type='html'>Hi, I am from Jakarta, Indonesia. This is my Erlang programming playground.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ivandarmawan.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7237281566556306193/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ivandarmawan.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ivan Darmawan.</name><uri>http://www.blogger.com/profile/09851675408770817194</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_mYbGmIH86K0/SnVV2laFx6I/AAAAAAAAABs/lvCT0cLGEu4/S220/ivan.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7237281566556306193.post-6974145111797818508</id><published>2009-08-01T12:46:00.000+07:00</published><updated>2009-08-01T14:01:04.633+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Erlang'/><category scheme='http://www.blogger.com/atom/ns#' term='Erlang Programming'/><title type='text'>Erlang: Why My Integer List Printed as String</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: 'times new roman'; "&gt;&lt;span style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt;&lt;span class="S1" style="font-size: 9pt; color: black; font-family: Verdana; "&gt;Let's try to run the following even/1 function code that I had taken from page 86 (paper) or 62 (pdf) of &lt;a href="http://www.erlangprogramming.org/" target="_blank"&gt;Erlang Programming&lt;/a&gt; book:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-family: monospace; "&gt;&lt;span style="color: rgb(0, 0, 0); font-size: 10pt; "&gt;&lt;blockquote&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;-&lt;/span&gt;&lt;span class="S4" style="color: rgb(0, 0, 127); font-size: 10pt; font-weight: bold; "&gt;module&lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;(&lt;/span&gt;&lt;span class="S7" style="color: rgb(0, 0, 128); font-size: 10pt; "&gt;example&lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;).&lt;/span&gt;&lt;br /&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;-&lt;/span&gt;&lt;span class="S4" style="color: rgb(0, 0, 127); font-size: 10pt; font-weight: bold; "&gt;export&lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;([&lt;/span&gt;&lt;span class="S8" style="color: rgb(255, 0, 0); font-size: 10pt; "&gt;even/1&lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;]).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="S7" style="color: rgb(0, 0, 128); font-size: 10pt; "&gt;even&lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;([])&lt;/span&gt;&lt;span class="S0" style="color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;-&gt;&lt;/span&gt;&lt;span class="S0" style="color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;[];&lt;/span&gt;&lt;br /&gt;&lt;span class="S7" style="color: rgb(0, 0, 128); font-size: 10pt; "&gt;even&lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;([&lt;/span&gt;&lt;span class="S2" style="color: rgb(128, 0, 64); font-size: 10pt; "&gt;H&lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;|&lt;/span&gt;&lt;span class="S2" style="color: rgb(128, 0, 64); font-size: 10pt; "&gt;T&lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;])&lt;/span&gt;&lt;span class="S0" style="color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S4" style="color: rgb(0, 0, 127); font-size: 10pt; font-weight: bold; "&gt;when&lt;/span&gt;&lt;span class="S0" style="color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S2" style="color: rgb(128, 0, 64); font-size: 10pt; "&gt;H&lt;/span&gt;&lt;span class="S0" style="color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S7" style="color: rgb(0, 0, 128); font-size: 10pt; "&gt;rem&lt;/span&gt;&lt;span class="S0" style="color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S3" style="color: rgb(0, 127, 127); font-size: 10pt; "&gt;2&lt;/span&gt;&lt;span class="S0" style="color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;==&lt;/span&gt;&lt;span class="S0" style="color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S3" style="color: rgb(0, 127, 127); font-size: 10pt; "&gt;0&lt;/span&gt;&lt;span class="S0" style="color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;-&gt;&lt;/span&gt;&lt;span class="S0" style="color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;[&lt;/span&gt;&lt;span class="S2" style="color: rgb(128, 0, 64); font-size: 10pt; "&gt;H&lt;/span&gt;&lt;span class="S0" style="color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;|&lt;/span&gt;&lt;span class="S0" style="color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S7" style="color: rgb(0, 0, 128); font-size: 10pt; "&gt;even&lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;(&lt;/span&gt;&lt;span class="S2" style="color: rgb(128, 0, 64); font-size: 10pt; "&gt;T&lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;)];&lt;/span&gt;&lt;br /&gt;&lt;span class="S7" style="color: rgb(0, 0, 128); font-size: 10pt; "&gt;even&lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;([&lt;/span&gt;&lt;span class="S0" style="color: rgb(0, 0, 0); font-size: 10pt; "&gt;_&lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;|&lt;/span&gt;&lt;span class="S2" style="color: rgb(128, 0, 64); font-size: 10pt; "&gt;T&lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;])&lt;/span&gt;&lt;span class="S0" style="color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;-&gt;&lt;/span&gt;&lt;span class="S0" style="color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S7" style="color: rgb(0, 0, 128); font-size: 10pt; "&gt;even&lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;(&lt;/span&gt;&lt;span class="S2" style="color: rgb(128, 0, 64); font-size: 10pt; "&gt;T&lt;/span&gt;&lt;span class="S6" style="color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;).&lt;/span&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'times new roman'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; "&gt;&lt;span style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt;&lt;span class="S1" style="font-size: 9pt; color: black; font-family: Verdana; "&gt;surprise that the function doesn’t produce desired result:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-weight: bold; "&gt;&lt;span style="color: rgb(0, 0, 0); font-size: 10pt; "&gt;&lt;blockquote&gt;&lt;span class="S1" style="font-size: 9pt; color: black; font-family: monospace; "&gt;1&gt; example:even([10,11,12]).         &lt;/span&gt;&lt;br /&gt;&lt;span class="S1" style="font-size: 9pt; color: black; font-family: monospace; "&gt;"\n\f"&lt;/span&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'times new roman'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; "&gt;&lt;span style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt;&lt;span class="S1" style="font-size: 9pt; color: black; font-family: Verdana; "&gt;the result should be [10,12] not "\n\f". Let's try typing the following line into Erlang shell:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; "&gt;&lt;span style="color: rgb(0, 0, 0); font-size: 10pt; "&gt;&lt;blockquote&gt;&lt;span class="S1" style="font-size: 9pt; color: black; font-weight: bold; font-family: monospace; "&gt;2&gt; [10,12].         &lt;/span&gt;&lt;br /&gt;&lt;span class="S1" style="font-size: 9pt; color: black; font-weight: bold; font-family: monospace; "&gt;"\n\f"&lt;/span&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-family: Verdana; "&gt;&lt;span style="color: rgb(0, 0, 0); font-size: 10pt; "&gt;&lt;span class="S1" style="font-size: 9pt; color: black; "&gt;It's shows you that there is nothing wrong with the result. Erlang prints the value of a list as a string, but only if all the integers in the list represent printable characters. The example of integers that printed without any conversion are 1, 2, 3, 4, 5, 6, and 7. A list with an unprintable character is printed without conversion. If your list is [1,10,12] you will get [1,10,12] not "1\n\f".&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'times new roman'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; "&gt;&lt;span style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="S1" style="font-size: 9pt; color: black; font-family: Verdana; "&gt;So I modify the codes into following. The result will be a tuple rather than a list.&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;-&lt;/span&gt;&lt;span class="S4" style="font-family: 'Courier New'; color: rgb(0, 0, 127); font-size: 10pt; font-weight: bold; "&gt;module&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;(&lt;/span&gt;&lt;span class="S7" style="font-family: 'Courier New'; color: rgb(0, 0, 128); font-size: 10pt; "&gt;example&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;).&lt;/span&gt;&lt;br /&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;-&lt;/span&gt;&lt;span class="S4" style="font-family: 'Courier New'; color: rgb(0, 0, 127); font-size: 10pt; font-weight: bold; "&gt;export&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;([&lt;/span&gt;&lt;span class="S8" style="font-family: 'Courier New'; color: rgb(255, 0, 0); font-size: 10pt; "&gt;even/1&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;]).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="S7" style="font-family: 'Courier New'; color: rgb(0, 0, 128); font-size: 10pt; "&gt;even&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;(&lt;/span&gt;&lt;span class="S2" style="font-family: 'Courier New'; color: rgb(128, 0, 64); font-size: 10pt; "&gt;L&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;)&lt;/span&gt;&lt;span class="S0" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;-&gt;&lt;/span&gt;&lt;span class="S0" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S7" style="font-family: 'Courier New'; color: rgb(0, 0, 128); font-size: 10pt; "&gt;list_to_tuple&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;(&lt;/span&gt;&lt;span class="S7" style="font-family: 'Courier New'; color: rgb(0, 0, 128); font-size: 10pt; "&gt;get_even&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;(&lt;/span&gt;&lt;span class="S2" style="font-family: 'Courier New'; color: rgb(128, 0, 64); font-size: 10pt; "&gt;L&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;)).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="S7" style="font-family: 'Courier New'; color: rgb(0, 0, 128); font-size: 10pt; "&gt;get_even&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;([])&lt;/span&gt;&lt;span class="S0" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;-&gt;&lt;/span&gt;&lt;span class="S0" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;[];&lt;/span&gt;&lt;br /&gt;&lt;span class="S7" style="font-family: 'Courier New'; color: rgb(0, 0, 128); font-size: 10pt; "&gt;get_even&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;([&lt;/span&gt;&lt;span class="S2" style="font-family: 'Courier New'; color: rgb(128, 0, 64); font-size: 10pt; "&gt;H&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;|&lt;/span&gt;&lt;span class="S2" style="font-family: 'Courier New'; color: rgb(128, 0, 64); font-size: 10pt; "&gt;T&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;])&lt;/span&gt;&lt;span class="S0" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S4" style="font-family: 'Courier New'; color: rgb(0, 0, 127); font-size: 10pt; font-weight: bold; "&gt;when&lt;/span&gt;&lt;span class="S0" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S2" style="font-family: 'Courier New'; color: rgb(128, 0, 64); font-size: 10pt; "&gt;H&lt;/span&gt;&lt;span class="S0" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S7" style="font-family: 'Courier New'; color: rgb(0, 0, 128); font-size: 10pt; "&gt;rem&lt;/span&gt;&lt;span class="S0" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S3" style="font-family: 'Courier New'; color: rgb(0, 127, 127); font-size: 10pt; "&gt;2&lt;/span&gt;&lt;span class="S0" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;==&lt;/span&gt;&lt;span class="S0" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S3" style="font-family: 'Courier New'; color: rgb(0, 127, 127); font-size: 10pt; "&gt;0&lt;/span&gt;&lt;span class="S0" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;-&gt;&lt;/span&gt;&lt;span class="S0" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;[&lt;/span&gt;&lt;span class="S2" style="font-family: 'Courier New'; color: rgb(128, 0, 64); font-size: 10pt; "&gt;H&lt;/span&gt;&lt;span class="S0" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;|&lt;/span&gt;&lt;span class="S0" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S7" style="font-family: 'Courier New'; color: rgb(0, 0, 128); font-size: 10pt; "&gt;get_even&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;(&lt;/span&gt;&lt;span class="S2" style="font-family: 'Courier New'; color: rgb(128, 0, 64); font-size: 10pt; "&gt;T&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;)];&lt;/span&gt;&lt;br /&gt;&lt;span class="S7" style="font-family: 'Courier New'; color: rgb(0, 0, 128); font-size: 10pt; "&gt;get_even&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;([&lt;/span&gt;&lt;span class="S0" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt;_&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;|&lt;/span&gt;&lt;span class="S2" style="font-family: 'Courier New'; color: rgb(128, 0, 64); font-size: 10pt; "&gt;T&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;])&lt;/span&gt;&lt;span class="S0" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;-&gt;&lt;/span&gt;&lt;span class="S0" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; "&gt; &lt;/span&gt;&lt;span class="S7" style="font-family: 'Courier New'; color: rgb(0, 0, 128); font-size: 10pt; "&gt;get_even&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;(&lt;/span&gt;&lt;span class="S2" style="font-family: 'Courier New'; color: rgb(128, 0, 64); font-size: 10pt; "&gt;T&lt;/span&gt;&lt;span class="S6" style="font-family: 'Courier New'; color: rgb(0, 0, 0); font-size: 10pt; font-weight: bold; "&gt;).&lt;/span&gt;&lt;/blockquote&gt;&lt;span class="S1" style="font-size: 9pt; color: black; font-family: Verdana; "&gt;Let's compile and run the modified module:&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span class="S1" style="font-family: 'Courier New'; font-size: 9pt; color: black; font-weight: bold; "&gt;3&gt; example:even([10,11,12]).         &lt;/span&gt;&lt;br /&gt;&lt;span class="S1" style="font-family: 'Courier New'; font-size: 9pt; color: black; font-weight: bold; "&gt;{10,12}&lt;/span&gt;&lt;/blockquote&gt;&lt;span class="S1" style="font-size: 9pt; color: black; font-family: Verdana; "&gt;If you want to convert a tuple to a list, use tuple_to_list() BIF.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7237281566556306193-6974145111797818508?l=ivandarmawan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ivandarmawan.blogspot.com/feeds/6974145111797818508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7237281566556306193&amp;postID=6974145111797818508' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7237281566556306193/posts/default/6974145111797818508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7237281566556306193/posts/default/6974145111797818508'/><link rel='alternate' type='text/html' href='http://ivandarmawan.blogspot.com/2009/08/erlang-why-my-integer-list-printed-as.html' title='Erlang: Why My Integer List Printed as String'/><author><name>Ivan Darmawan.</name><uri>http://www.blogger.com/profile/09851675408770817194</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_mYbGmIH86K0/SnVV2laFx6I/AAAAAAAAABs/lvCT0cLGEu4/S220/ivan.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7237281566556306193.post-6632291359483040910</id><published>2009-07-21T19:18:00.009+07:00</published><updated>2009-07-21T20:46:04.926+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Erlang'/><category scheme='http://www.blogger.com/atom/ns#' term='Erlang Programming'/><title type='text'>Erlang Programming, Exercise 2-3: Simple Pattern Matching</title><content type='html'>&lt;span class="Apple-style-span"  style="font-family:'times new roman';"&gt;&lt;span style=" color: rgb(0, 0, 0);  font-family:'Courier New';"&gt;&lt;span class="S6"  style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';"&gt;&lt;span class="Apple-style-span"  style="font-size:x-large;"&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style=" font-weight: normal; color: rgb(51, 51, 51);  line-height: 16px; font-family:'times new roman';font-size:13px;"&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; line-height: 1.3em; background-color: rgb(255, 255, 255); "&gt;&lt;span class="Apple-style-span"   style="font-family:verdana;font-size:130%;"&gt;&lt;span class="Apple-style-span"  style="font-size:16px;"&gt;&lt;b&gt;&lt;span class="Apple-style-span"   style=" font-weight: normal; line-height: 16px;  font-family:'times new roman';font-size:13px;"&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; line-height: 1.3em; background-color: rgb(255, 255, 255); "&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style=" ;font-family:verdana;"&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;/blockquote&gt;I am reading &lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;a href="http://www.erlangprogramming.org/"&gt;Erlang Programming&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style=" ;font-family:verdana;"&gt; book. This is the solution of Exercise 2-3: Simple Pattern Matching. Following is the original question:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; line-height: 1.3em; background-color: rgb(255, 255, 255); "&gt;&lt;span&gt;&lt;span&gt;&lt;blockquote style="margin-top: 1em; margin-right: 20px; margin-bottom: 1em; margin-left: 20px; "&gt;&lt;span class="Apple-style-span"  style=" ;font-family:verdana;"&gt;Write a module boolean.erl that takes logical expressions and Boolean values (represented as the atoms true and false) and returns their Boolean result. The functions you write should include b_not/1, b_and/2, b_or/2, and b_nand/2. You should not use the logical constructs and, or, and not, but instead use pattern matching to achieve your goal.&lt;br /&gt;&lt;br /&gt;Test your module from the shell. Some examples of calling the exported functions in your module include:&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style=" ;font-family:'courier new';"&gt;bool:b_not(false) =&gt; true&lt;br /&gt;bool:b_and(false, true) =&gt; false&lt;br /&gt;bool:b_and(bool:b_not(bool:b_and(true, false)), true) =&gt; true&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The notation foo(X) =&gt; Y means that calling the function foo with parameter X will result in the value Y being returned. Keep in mind that and, or, and not are reserved words in Erlang, so you must prefix the function names with b_.&lt;/span&gt;&lt;/blockquote&gt;&lt;span class="Apple-style-span"  style=" ;font-family:verdana;"&gt;&lt;blockquote style="margin-top: 1em; margin-right: 20px; margin-bottom: 1em; margin-left: 20px; "&gt;Hint: implement b_nand/2 using b_not/1 and b_and/2.&lt;/blockquote&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style=" ;font-family:verdana;"&gt;The solution is:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; line-height: 1.3em; background-color: rgb(255, 255, 255); "&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"   style="color: rgb(0, 0, 0);   line-height: normal; font-family:'times new roman';font-size:16px;"&gt;&lt;span style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;-&lt;/span&gt;&lt;span class="S4"   style=" color: rgb(0, 0, 127);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;module&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;(&lt;/span&gt;&lt;span class="S7"   style=" color: rgb(0, 0, 128);  font-family:'Courier New';font-size:10pt;"&gt;bool&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;).&lt;/span&gt;&lt;br /&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;-&lt;/span&gt;&lt;span class="S4"   style=" color: rgb(0, 0, 127);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;export&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;([&lt;/span&gt;&lt;span class="S8"   style=" color: rgb(255, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt;b_not/1&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;,&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S8"   style=" color: rgb(255, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt;b_and/2&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;,&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S8"   style=" color: rgb(255, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt;b_or/2&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;,&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S8"   style=" color: rgb(255, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt;b_nand/2&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;]).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="S7"   style=" color: rgb(0, 0, 128);  font-family:'Courier New';font-size:10pt;"&gt;b_not&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;(&lt;/span&gt;&lt;span class="S2"   style=" color: rgb(128, 0, 64);  font-family:'Courier New';font-size:10pt;"&gt;X&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;)&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;-&gt;&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S2"   style=" color: rgb(128, 0, 64);  font-family:'Courier New';font-size:10pt;"&gt;X&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;==&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S7"   style=" color: rgb(0, 0, 128);  font-family:'Courier New';font-size:10pt;"&gt;false&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span class="S7"   style=" color: rgb(0, 0, 128);  font-family:'Courier New';font-size:10pt;"&gt;b_and&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;(&lt;/span&gt;&lt;span class="S2"   style=" color: rgb(128, 0, 64);  font-family:'Courier New';font-size:10pt;"&gt;X&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;,&lt;/span&gt;&lt;span class="S2"   style=" color: rgb(128, 0, 64);  font-family:'Courier New';font-size:10pt;"&gt;Y&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;)&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;-&gt;&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;{&lt;/span&gt;&lt;span class="S7"   style=" color: rgb(0, 0, 128);  font-family:'Courier New';font-size:10pt;"&gt;true&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;,&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S7"   style=" color: rgb(0, 0, 128);  font-family:'Courier New';font-size:10pt;"&gt;true&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;}&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;==&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;{&lt;/span&gt;&lt;span class="S2"   style=" color: rgb(128, 0, 64);  font-family:'Courier New';font-size:10pt;"&gt;X&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;,&lt;/span&gt;&lt;span class="S2"   style=" color: rgb(128, 0, 64);  font-family:'Courier New';font-size:10pt;"&gt;Y&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;}.&lt;/span&gt;&lt;br /&gt;&lt;span class="S7"   style=" color: rgb(0, 0, 128);  font-family:'Courier New';font-size:10pt;"&gt;b_or&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;(&lt;/span&gt;&lt;span class="S2"   style=" color: rgb(128, 0, 64);  font-family:'Courier New';font-size:10pt;"&gt;X&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;,&lt;/span&gt;&lt;span class="S2"   style=" color: rgb(128, 0, 64);  font-family:'Courier New';font-size:10pt;"&gt;Y&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;)&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;-&gt;&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S7"   style=" color: rgb(0, 0, 128);  font-family:'Courier New';font-size:10pt;"&gt;b_not&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;({&lt;/span&gt;&lt;span class="S7"   style=" color: rgb(0, 0, 128);  font-family:'Courier New';font-size:10pt;"&gt;false&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;,&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S7"   style=" color: rgb(0, 0, 128);  font-family:'Courier New';font-size:10pt;"&gt;false&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;}&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;==&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;{&lt;/span&gt;&lt;span class="S2"   style=" color: rgb(128, 0, 64);  font-family:'Courier New';font-size:10pt;"&gt;X&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;,&lt;/span&gt;&lt;span class="S2"   style=" color: rgb(128, 0, 64);  font-family:'Courier New';font-size:10pt;"&gt;Y&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;}).&lt;/span&gt;&lt;br /&gt;&lt;span class="S7"   style=" color: rgb(0, 0, 128);  font-family:'Courier New';font-size:10pt;"&gt;b_nand&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;(&lt;/span&gt;&lt;span class="S2"   style=" color: rgb(128, 0, 64);  font-family:'Courier New';font-size:10pt;"&gt;X&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;,&lt;/span&gt;&lt;span class="S2"   style=" color: rgb(128, 0, 64);  font-family:'Courier New';font-size:10pt;"&gt;Y&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;)&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;-&gt;&lt;/span&gt;&lt;span class="S0"   style=" color: rgb(0, 0, 0);  font-family:'Courier New';font-size:10pt;"&gt; &lt;/span&gt;&lt;span class="S7"   style=" color: rgb(0, 0, 128);  font-family:'Courier New';font-size:10pt;"&gt;b_not&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;(&lt;/span&gt;&lt;span class="S7"   style=" color: rgb(0, 0, 128);  font-family:'Courier New';font-size:10pt;"&gt;b_and&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;(&lt;/span&gt;&lt;span class="S2"   style=" color: rgb(128, 0, 64);  font-family:'Courier New';font-size:10pt;"&gt;X&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;,&lt;/span&gt;&lt;span class="S2"   style=" color: rgb(128, 0, 64);  font-family:'Courier New';font-size:10pt;"&gt;Y&lt;/span&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;)).&lt;/span&gt;&lt;/blockquote&gt;&lt;span class="S6"   style=" color: rgb(0, 0, 0);  font-weight: bold; font-family:'Courier New';font-size:10pt;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.75em; margin-left: 0px; line-height: 1.3em; background-color: rgb(255, 255, 255); "&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style=" ;font-family:verdana;"&gt;Any better solutions?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7237281566556306193-6632291359483040910?l=ivandarmawan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ivandarmawan.blogspot.com/feeds/6632291359483040910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7237281566556306193&amp;postID=6632291359483040910' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7237281566556306193/posts/default/6632291359483040910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7237281566556306193/posts/default/6632291359483040910'/><link rel='alternate' type='text/html' href='http://ivandarmawan.blogspot.com/2009/07/erlang-programming-exercise-2-3-simple.html' title='Erlang Programming, Exercise 2-3: Simple Pattern Matching'/><author><name>Ivan Darmawan.</name><uri>http://www.blogger.com/profile/09851675408770817194</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://3.bp.blogspot.com/_mYbGmIH86K0/SnVV2laFx6I/AAAAAAAAABs/lvCT0cLGEu4/S220/ivan.jpg'/></author><thr:total>1</thr:total></entry></feed>
