tag:blogger.com,1999:blog-27016285224412284962024-02-08T12:26:18.816-08:00On Erlanggnupatehttp://www.blogger.com/profile/10492341480170667775noreply@blogger.comBlogger17125tag:blogger.com,1999:blog-2701628522441228496.post-12934533431468485842008-02-25T05:54:00.000-08:002008-02-25T10:22:46.466-08:00Practical Erlang Mini-Interview<p>I’d like to thank Francesco Cesarini and Mike Loukides for taking a momen to answer a couple of questions about <a href="http://www.oreilly.com">O’Reilly’s</a> upcoming ‘Practical Erlang Programming’ book. I think getting answers straight from the horse's mouth is a lot better than the <a href="http://on-erlang.blogspot.com/2008/02/more-book-rumours.html">other</a> <a href="http://on-erlang.blogspot.com/2008/02/not-just-rumour.html">rumours</a> I’ve <a href="http://http://on-erlang.blogspot.com/2008/02/books-and-rumours-of-books.html">posted</a>. Hopefully, I’ll be able to pin Francesco, Jan, and Mike down for some more questions as the book progresses.</p><br /><br /><br /><hr align="center" width=70% /><br /><br /><p><strong>You talk about this book being less broad, but deeper than <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FProgramming-Erlang-Software-Concurrent-World%2Fdp%2F193435600X&tag=urandomthough-20&linkCode=ur2&camp=1789&creative=9325">Programming Erlang: Software for a Concurrent World</a><img src="http://www.assoc-amazon.com/e/ir?t=urandomthough-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />. What does this mean to you?</strong></p><br /><br /><br /><blockquote><br /><p><strong>Francesco</strong> To me, it means the ability to ensure that everyone, regardless of background and previous knowledge of programming languages, is able to pick up the book and learn Erlang. Having taught Erlang to everyone, from corporate clients to university students, I know where they struggle and where the problems have been throughout the years. On one side, this resulted in our training materials evolving. On the other, it resulted in our teaching methods and hands on examples evolving. We are going into all of these details, explaining in depth areas we know readers will struggle with. We will be using many more examples, both from our training material and from our lectures, where we ask the delegates to use the shell as we explain the theory.</p><br /></blockquote><br /><br /><br /><p><strong>Why now? What makes you think the market is ready for another book on Erlang? What’s changed?</strong></p><br /><br /><br /><blockquote><br /><p><strong>Francesco</strong> Erlang is expanding exponentially. Concurrency and <span class="caps">SMP</span> together with Joe’s book have pushed it to its next level. This has resulted in a critical mass which is helping us generate even more users. The market is ready not for one or two books, but for many books, as they generate traction and help each other. My hope is that this will result in an even greater critical mass.</p><br /></blockquote><br /><br /><br /><blockquote><br /><p><strong>Mike</strong> I tend to sign books on technologies that I want to learn about, or that I think I need to learn about. We tend to cover this up with lots of stuff that we call market analysis, but ultimately, that’s what it comes down to.</p><br /></blockquote><br /><br /><br /><blockquote><br /><p>I was really surprised to see that the Haskell talks at OSCon were not just well attended, they had all the top spots. We didn’t have anything going on in Erlang, but my guess is that it would have shared the top of the list with Haskell. It’s not entirely clear what’s driving this. In the Ruby world, there are clearly a lot of concurrency issues that Erlang can help to solve. (One of the things that convinced me of the importance of Erlang was Lucas Carlson’s drproxy, which is a distributed reverse proxy server written in Erlang.</p><br /></blockquote><br /><br /><br /><blockquote><br /><p>But I don’t think the Ruby community is really driving the interest in Erlang or in functional languages. There have been many other things happening: Microsoft’s F#, functional features in Sun’s Fortress, the Scala language, etc. What seems to be driving the interest is the idea that functional languages are going to make it easier to exploit parallelism, in a world where a low-end laptop has 8-16 cores. We’re not there now, but give it a few years and we will be. I certainly feel that programming paradigms are shifting, and they’re shifting in the direction of functional languages. Erlang is benefitting from that shift—particularly since Erlang was designed from the bottom up with concurrency in mind.</p><br /></blockquote>gnupatehttp://www.blogger.com/profile/10492341480170667775noreply@blogger.com2tag:blogger.com,1999:blog-2701628522441228496.post-44317850856745245302008-02-20T09:29:00.000-08:002008-02-20T09:37:29.585-08:00More Book Rumours<p>I spent about an hour on the phone with a publisher yesterday (not <a href="http://www.reilly.com">O'Reilly</a> or <a href="http://www.pragprog.com">the Prags</a>) talking about their plans for functional and concurrent programming books. I've got to say that I came away pretty excited about what they have in mind. I won't name names or post a lot of details, but here are three cool things that stood out:<ul><br /><li>They get the idea that there are two groups of people wanting to learn Erlang (Erlang programmers and programmers who want to learn more about Erlang's approach to concurrency) and they are targeting both camps.</li><br /><li>They're talking about more than one book — I'm not sure how many though</li><br /><li>Their first book is planned to be very hands-on, which I think is great.</li><br /></ul></p><br /><br /><p>Once they're a little bit closer to making announcements, maybe I'll have some more news to post. On a related note, I'm hoping to have some more information on O'Reilly's Practical Erlang soon too. </p>gnupatehttp://www.blogger.com/profile/10492341480170667775noreply@blogger.com1tag:blogger.com,1999:blog-2701628522441228496.post-52019312892825391952008-02-13T07:57:00.000-08:002008-02-13T07:58:30.551-08:00Not Just a Rumour<p>Just a quick update to <a href="http://on-erlang.blogspot.com/2008/02/books-and-rumours-of-books.html">yesterday’s post</a>. I think we can confirm this rumour. As <a href="http://dmitriid.livejournal.com/">Mamut</a> mentioned <a href="http://video.google.com/videoplay?docid=6264026634932619900&q=Free+Session%3A+In-the-Brain+of+Francesco+Cesarini+on+Erlang+for+5+Nines&total=1&start=0&num=10&so=0&type=search&plindex=0">this presentation</a> mentions the book. I’ve also heard back from Mike Loukides inside <a href="http://www.oreilly.com">O’Reilly</a>. I asked him if O’Reilly was really working on an Erlang book, and he told me:</p><br /><br /><br /><blockquote><br /><p>It’s true. There’s not much that I can say right now—the Erlang book is still in the very early stages. So any predictions I can make about when it’s likely to be available are likely to be wrong. But they’re off to a good start, though.</p><br /></blockquote><br /><br /><br /><p>Good news all around.</p>gnupatehttp://www.blogger.com/profile/10492341480170667775noreply@blogger.com1tag:blogger.com,1999:blog-2701628522441228496.post-67367516443737862652008-02-12T18:24:00.000-08:002008-02-12T18:29:14.901-08:00Books and Rumours of Books<p>Hot on the heels of the <a href="http://on-erlang.blogspot.com/2008/2/feb-2008-tidbits.html">news that ‘Hardcore Erlang’ is no more</a> I’m hearing rumours that <a href="http://www.oreilly.com">O’Reilly</a> is working on a ‘Practical Erlang’ book to go alongside <a href="http://book.realworldhaskell.org/">their ‘Practical Haskell’ book</a>. My informant has told me a couple of things:<ol><br /><li>the authors are also involved in teaching Erlang classes</li><br /><li>there is going to be a website for the book soon</li><br /><li>the book is going to be deeper (though less broad) than <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FProgramming-Erlang-Software-Concurrent-World%2Fdp%2F193435600X%2F&tag=urandomthough-20&linkCode=ur2&camp=1789&creative=9325">Programming Erlang: Software for a Concurrent World</a><img src="http://www.assoc-amazon.com/e/ir?t=urandomthough-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></li><br /></ol></p><br /><br /><br /><p>I’m hoping to get an interview with the authors as the book gets closer to publication. Until then, I’ll see what more information I can lay my hands on.</p>gnupatehttp://www.blogger.com/profile/10492341480170667775noreply@blogger.com2tag:blogger.com,1999:blog-2701628522441228496.post-70221170587244505782008-02-06T07:56:00.000-08:002008-02-06T07:58:39.314-08:00Feb 2008 Tidbits<p>Okay, here are a few quick bits about Erlang that I wanted to get up for people to see.</p><br /><br /><p>It looks like <a href="http://www.erlang-consulting.com">Erlang Training and Consulting Ltd</a> is going to be busy with Erlang training in the US this year. They’ve <a href="http://www.erlang-consulting.com/training/schedule.html#us">scheduled seven courses spread over four US cities this year</a>. If you’re in Los Angelas, New York City, Chicago, or Palo Alto (or close enough to make the trip), you might be in luck.</p><br /><br /><p>If those courses won’t work for you, you might also keep your eye out for the Pragmatic Programmers <a href="http://pragmaticstudio.com/erlang/">Erlang Sutdio</a>. The only one scheduled so far is in Chicago, and is already full, but who knows where the next one will be—maybe you can talk the prags into bringing one to your home town.</p><br /><br /><p>Speaking of the prags, <a href="http://twitter.com/wagerlabs/statuses/659726302">it looks like Joel won’t be doing the Hardcore Erlang book for them</a> after all. As <a href="http://weblog.hypotheticalabs.com/?p=201">Kevin wrote over on his hypothetical labs blog</a>, this is really too bad. I was looking forward to a follow up to <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2Fdp%2F193435600X&tag=urandomthough-20&linkCode=ur2&camp=1789&creative=9325">Programming Erlang</a><img src="http://www.assoc-amazon.com/e/ir?t=urandomthough-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />. The silver lining to this cloud is that Joel will be <a href="http://www.wagerlabs.com/blog/erlang/index.html">posting the content to his blog</a>.</p>gnupatehttp://www.blogger.com/profile/10492341480170667775noreply@blogger.com0tag:blogger.com,1999:blog-2701628522441228496.post-89033565335392809392007-10-08T13:01:00.001-07:002007-10-08T13:01:53.013-07:00Reading SICP 1.1.6<p>This time around, I’ve decided to toss the translations for Ruby, Factor, and Erlang into the same post instead of trying to juggle multiple posts and point them all at one another. So, without further ado …</p><br /><br /><h2>Section 1.1.6</h2><br /><br /><p>Let’s take a look at section 1.1.6, the goal of this section is to look at conditional expressions through implementing an absolute value procedure. the book iterates through a couple of versions, trimming away fat. In each of my examples below, I’ve only shown the final product.</p><br /><br /><p>In Ruby, the code should look something like this:</p><br /><pre><code><br />def abs(num) <br /> if num < 0<br /> num = -num<br /> end<br /> return num<br />end<br /></code></pre><br /><br /><p>In Factor it looks like this:</p><br /><pre><code><br />: abs ( n -- n ) dup 0 < [ -1 * ] [ ] if ;<br /></code></pre><br /><br /><p>And in Erlang it looks like this (I’ve left out the administrative bits from the top of the file):</p><br /><pre><code><br />abs(A) -><br /> case ( A < 0) of<br /> true -> -1 * A;<br /> false -> A<br /> end.<br /></code></pre><br /><br /><h2>Exercise 1.3</h2><br /><br /><p>Esercise 1.3 asks the reader to write a procedure that takes three numbers and returns the sum of the squares of the largest two of them. In each case below, I rely on the previously defined square and sum-of-squares (sum_of_squares) procedures.</p><br /><br /><p>Ruby was pretty easy:</p><br /><pre><code><br />def sum_squares_of_larger(a, b, c)<br /> sorted_nums = [a, b, c].sort.reverse<br /> sum_of_squares(sorted_nums[0], sorted_nums[1])<br />end<br /></code></pre><br /><br /><p>Factor took me a while to figure out (mostly in trying to figure out how to build the array):</p><br /><pre><code><br />: top-two ( x,y,z -- x,y ) 3array natural-sort reverse first2 ;<br />: sum-squares-of-larger ( x,y,z -- x ) top-two sum-of-squares ;<br /></code></pre><br /><br /><p>I’m least sure of my Erlang code. I couldn’t find a good function for sorting the array, so I borrowed the qsort function from Programming Erlang. In any case, here’s my cut at it:</p><br /><pre><code><br />qsort([]) -><br /> [];<br />qsort([Pivot|T]) -><br /> qsort([X || X <- T, X < Pivot])<br /> ++ [Pivot] ++<br /> qsort([X || X <- T, X >= Pivot]).<br /><br />last_two([H|T]) -> <br /> T.<br /><br />sum_of_squares_of_list(L) -><br /> lists:sum([square(A) || A <- L]). <br /><br />sum_squares_of_larger(A, B, C) -><br /> sum_of_squares_of_list(last_two(qsort([A,B,C]))).<br /></code></pre><br /><br /><h2>What I learned</h2><br /><br /><p>The biggest thing I’ve taken away from this exercise so far is that I really need a good Factor book that covers both the language and the vocabulary. Along similar lines, Programming Erlang is a good book, but it could have spent some more time on basic programming (especially covering the provided functions in something other than an appendix).</p><br /><br /><p>Factor has been the language that’s been hardest to wrap my mind around so far. At the same time, it’s the one that I’ve enjoyed the most—I also think the word definitions have a sort of terse beauty. I think Ruby is probably the one that most programmers could just pick up and maintain though.</p><br /><br /><p>Next up, Section 1.1.7 “Square Roots By Newton’s Method”.</p>gnupatehttp://www.blogger.com/profile/10492341480170667775noreply@blogger.com6tag:blogger.com,1999:blog-2701628522441228496.post-43573586594752212272007-10-04T20:17:00.000-07:002007-10-04T20:19:05.187-07:00Reading SICP in Erlang: Section 1.1.4<p>Ok, here’s my erlang take on Section 1.1.4 of <span class="caps">SICP</span>, or you can go look at my <a href="http://on-ruby.blogspot.com/2007/10/reading-sicp-in-factor-section-114.html">Ruby</a> or <a href="http://on-ruby.blogspot.com/2007/10/reading-sicp-in-ruby-114.html">Factor</a> versions.</p><br /><br /><br /> <p>Unlike Scheme, Ruby, or Factor, I’ve got to put the code for the <tt>square</tt> and <tt>sum_of_squares</tt> functions<sup><a href="#fn1">1</a></sup> into a separate file. I’m not going to explain the mechanics of the file, but we can take a look at the functions themselves.</p><br /><br /><br /><pre><strong>sicp.erl</strong><br /><code> -module(sicp).<br /> -export([square/1]).<br /> -export([sum_of_squares/2]).<br /> square(A) -> A * A.<br /> sum_of_squares(A, B) -> sicp:square(A) + sicp:square(B).<br /></code></pre><br /><br /> <p><tt>square</tt> has an arity of 1 (it takes a single argument), and returns the value of that argument times itself. Because mulitplication only works with numeric types, it will work for integers and floats, but will fail for non-numeric arguments.</p><br /><br /><br /> <p>To execute these functions we need to compile the code (see line 1 below). Then we just call the function (with its module namespace) and give it an appropriate argument.</p><br /><br /><br /><pre><code><br />1> c(sicp).<br />{ok,sicp}<br />2> sicp:square(5).<br />25<br />3> sicp:sum_of_squares(3,4).<br />25<br /></code></pre><br /><br /> <p>And that’s about all there is to it. Pretty simple stuff. Next up will be section 1.1.6 exercise 1.3.</p><br /><br /><br /> <p id="fn1"><sup>1</sup> In <span class="caps">SICP</span> they’re called procedures; in Ruby, methods; and in Factor, words. I just need to try to keep them all straight.</p>gnupatehttp://www.blogger.com/profile/10492341480170667775noreply@blogger.com0tag:blogger.com,1999:blog-2701628522441228496.post-61935758748221788242007-09-26T10:07:00.000-07:002007-09-26T10:08:19.006-07:00Reading SICP in Erlang and Ruby<iframe src="http://rcm.amazon.com/e/cm?t=urandomthough-20&o=1&p=8&l=as1&asins=0262011530&fc1=000000&IS1=1&lt1=_blank&lc1=0000FF&bc1=FFFFFF&bg1=FFFFFF&f=ifr&npa=1" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" align="left"></iframe><br /><br /><p>I’ve had a <a href="http://www.43things.com/person/pate">long standing goal</a> to read <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FStructure-Interpretation-Computer-Programs-Engineering%2Fdp%2F0262510871%2F&tag=urandomthough-20&linkCode=ur2&camp=1789&creative=9325"><span class="caps">SICP</span></a><img src="http://www.assoc-amazon.com/e/ir?t=urandomthough-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />, but it keeps conflicting with other goals, like mastering Ruby or learning Erlang (to name a couple of geeky ones). Recently I learned of a <a href="http://www.codepoetics.com/wiki/index.php?title=Topics:SICP_in_other_languages">project</a> to ‘translate’ <span class="caps">SICP</span> into Erlang (and other languages).</p><br /><br /><br /><p>“Great! I can use this to help with both learning Erlang and reading <span class="caps">SICP</span>”, I thought and went to take a look at it. It turns out they also have a Ruby translation underway, so I went to look at that first. It turns out that the first couple of examples make me think that they either don’t understand Ruby or don’t understand <span class="caps">SICP</span>.</p><br /><br /><br /><p>Page 5 of <span class="caps">SICP</span> shows that you can start up a <span class="caps">LISP</span> or scheme interpreter and type in an expression and it will return that expression, like this:<br /><pre><code><br /> > 486<br /> 486<br /> ><br /></code></pre><br />The site recommends the following Ruby <tt>puts 486</tt>, which is not quite right:<br /><pre><code><br />irb(main):001:0> puts 486<br />486<br />=> nil<br />irb(main):002:0><br /></code></pre><br />You see, this prints <tt>486</tt>, but returns <tt>nil</tt>. A much better answer looks a lot more like scheme:<br /><pre><code><br />irb(main):002:0> 486<br />=> 486<br />irb(main):003:0><br /></code></pre></p><br /><br /><p>With a problem like this early on, I’m not sure that I trust the Erlang or other translations. I do like the idea though, so I should probably stick with my idea of combining the goals, and just post my own translations into Erlang and Ruby (and let everyone else find <strong>my</strong> mistakes).</p>gnupatehttp://www.blogger.com/profile/10492341480170667775noreply@blogger.com0tag:blogger.com,1999:blog-2701628522441228496.post-85353651960134227412007-09-19T07:55:00.000-07:002007-09-19T08:11:15.608-07:00Long Time No Write<p>It’s been a while since I’ve written anything here, and (sadly) a long time since I’ve taken any time to focus on Erlang. I’d like to rectify both of these deficencies, so here’s a first stab.</p><br /><br /><br /> <p>First off, I’d like to drum up another Provo Erlounge for October 9th at 7PM (MST). We can meet at the Open Source Technology Center again (we’re supposed to have wireless access at that point). There are a couple of routes we can go, either hitting the Concurrent Programming and Distributed Programming chapters from <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FProgramming-Erlang-Software-Concurrent-World%2Fdp%2F193435600X%2F&tag=urandomthough-20&linkCode=ur2&camp=1789&creative=9325">Programming Erlang: Software for a Concurrent World</a><img src="http://www.assoc-amazon.com/e/ir?t=urandomthough-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> or walking through some ‘real world’ Erlang code. Anyone have a request/suggestion for us?</p><br /><br /><br /> <p>Secondly (and more generally), I’ve recently been talking with a publisher about their entry into the Functional Programming world. They’re very interested in doing this, and seem to have a good plan. They haven’t settled on which language(s) they want to cover yet, but Erlang is on their list. They would like feedback on which languages, potential topics, and potential authors would be of interest. If you’d like to leave a comment here, I’d be happy to pass the information along. If you’re worried about other publishers mining the information (but, hey, that would just mean more potential books on Erlang and FP wouldn’t it?), feel free to <a href="mailto://pat.eyler@gmail.com?Subject=Erlang Book Ideas">email me</a> directly.</p><br /><br /><br /> <p>And now, it’s off to spend a little time with Erlang.</p>gnupatehttp://www.blogger.com/profile/10492341480170667775noreply@blogger.com0tag:blogger.com,1999:blog-2701628522441228496.post-13680692470469183552007-06-11T07:25:00.001-07:002007-06-11T07:25:46.138-07:00May Contest Winners<iframe src="http://rcm.amazon.com/e/cm?t=urandomthough-20&o=1&p=8&l=as1&asins=193435600X&fc1=000000&IS1=1&lt1=_blank&lc1=0000FF&bc1=FFFFFF&bg1=FFFFFF&f=ifr&npa=1" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" align="center"></iframe><br /><br /> <p>After going through the contest entrants for May, we’ve come to a decision.<br /><a href="http://armstrongonsoftware.blogspot.com/">Joe</a>, <a href="http://pragdave.pragprog.com/">Dave</a>, and I couldn’t decide between <a href="http://www.jerith.za.net/writings/erlangsockettut.html">an entry on socket programming</a> (which appears to be broken now) and <a href="http://bestfriendchris.com/blog/2007/05/11/eunit-vs-erunit/">one on ErlUnit</a>.</p><br /><br /><br /> <p>The writers of these posts should drop me a line to get set up for their free copies of <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FProgramming-Erlang-Software-Concurrent-World%2Fdp%2F193435600X%2F&tag=urandomthough-20&linkCode=ur2&camp=1789&creative=9325">Programming Erlang: Software for a Concurrent World</a><img src="http://www.assoc-amazon.com/e/ir?t=urandomthough-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />.</p><br /><br /><br /> <p>If you’re interested in a copy, never fear. The Erlang Blogging contest is still running. Go ahead and write a blog post about Erlang, and add a link to it in the comments below. If you’re post is selected as our June Winner, you’ll win a copy of Joe’s book as soon as it’s in print. Great topics to write about include tools for Erlang programming, tutorials about Erlang modules or software, and tutorials about Erlang itself.</p><br /><br /><br /> <p>Thanks for the support in May, and good luck to everyone who enters in June.</p>gnupatehttp://www.blogger.com/profile/10492341480170667775noreply@blogger.com3tag:blogger.com,1999:blog-2701628522441228496.post-33156339858412635002007-05-17T07:42:00.000-07:002007-05-17T07:43:29.892-07:00Pragmatic Haskell<p>Wow! <a href="http://blogs.nubgames.com/code/?p=23">Pragmatic Haskell</a> seems like it might be on the way too. I’d love to work with Haskel and Erlang side by side to get a better feel for Functional Programming, and a book by the Prags is probably the only way I’ll get into Haskell—the other books/tutorials I’ve seen just don’t work for the way my brain is wired (I’m guessing that I won’t need a cheat sheet to figure out how to write/read the code in this book).</p><br /><br /><br /> <p>Now, we just need to watch for an official announcement. I’m hoping it will be a beta book also.</p>gnupatehttp://www.blogger.com/profile/10492341480170667775noreply@blogger.com0tag:blogger.com,1999:blog-2701628522441228496.post-82722147104482285202007-05-09T06:07:00.001-07:002007-05-09T06:07:55.850-07:00Successful Provo erlounge<p>Well, we got our Utah Valley Erlang group started with a bang—11 enthusiasts showed up (I hesitate to say hackers because most of us are newbies). We had a quick review of Erlang’s history and problem domain, and took a look at some code (the <a href="http://www.erlang.org/examples/small_examples/webput.erl">webput.erl</a> example). A couple of folks also got Erlang installed on their laptops.</p><br /><br /><br /> <p>It wasn’t a bad start, but we’re not nearly done. We’ll be meeting from 7-9PM on the second Tuesday of every month going forward. The Open Source Technology Center has been kind enough to offer us meeting space—they even provided Pizza and soda this time around. For our June meeting, we’re each going to try our hand at writing some Erlang (something that will be run cooperatively over our laptops), then we’ll do a ‘show and tell’/code review. If I can just think of something interesting, but not too hard, it should be a lot of fun.</p><br /><br /><br /> <p>If you’re interested in joining us please do, we’d love the company. We plan on coordinating our meetings on the erlang-questions list unless we get to big/noisy/rowdy for it.</p>gnupatehttp://www.blogger.com/profile/10492341480170667775noreply@blogger.com7tag:blogger.com,1999:blog-2701628522441228496.post-26011905014791892472007-05-01T11:20:00.000-07:002007-05-02T05:41:45.607-07:00May Blogging Contest<p><em>Updated! See below for a clarification.</em></p><br /><br /><p><img src="http://www.pragmaticprogrammer.com/images/jaerlang_small.jpg" alt="Programming Erlang: Software for a concurrent World" align="left"> <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FProgramming-Erlang-Software-Concurrent-World%2Fdp%2F193435600X%2F&tag=urandomthough-20&linkCode=ur2&camp=1789&creative=9325">Programming Erlang: Software for a Concurrent World</a><img src="http://www.assoc-amazon.com/e/ir?t=urandomthough-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> seems to be bringing a lot of attention to Erlang right now. In hopes of helping some of us newbies stick, I’ve worked out a deal with Dave Thomas, <a href=":http://www.pragmaticprogrammer.com">the Pragmatic Programmers</a> are sponsoring a blogging contest over the next three months (May, June, and July). I can almost hear you asking yourselves, “What’s a blogging contest and what does this have to do with me?” Well here’s the deal:</p><br /><br /><br /> <p>I’d like to invite you to write a tutorial or explanatory post that supports or supplements ‘Programming Erlang’. At the end of each month, I’ll collect the entries and working with another judge (the prags and I are still working out who) will determine the winning entry. The author of the winning entry will receive a copy of <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FProgramming-Erlang-Software-Concurrent-World%2Fdp%2F193435600X%2F&tag=urandomthough-20&linkCode=ur2&camp=1789&creative=9325">Programming Erlang</a><img src="http://www.assoc-amazon.com/e/ir?t=urandomthough-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />.</p><br /><br /><br /> <p>For the rest of May, ending at midnight on the 31st (MDT), I’ll be collecting entries in the comments section of this post. In June and July, I’ll put up new blog posts to collect links. I’m looking forward to reading a lot of great blog posts, good luck everyone!</p><br /><br /><p><em>Update:</em></p><br /><br /><p>You should be able to write any introductory to intermediate tutorial about erlang or tools around erlang for your entry. If you want to take a look at the Table of Contents for the book, you could always look <a href="http://www.pragmaticprogrammer.com/titles/jaerlang/">here</a></p><br /><br /><p>Alternatively, you could buy the beta (pdf only) and look forward to getting a hard copy once you've written your prize winning entry.</p>gnupatehttp://www.blogger.com/profile/10492341480170667775noreply@blogger.com6tag:blogger.com,1999:blog-2701628522441228496.post-58064228071066816282007-04-25T10:46:00.000-07:002007-04-25T10:47:17.930-07:00Erlang Nights in Utah<p>Well, it looks like I’m not the only Ruby hacker in Utah that’s looking at Erlang. In the UtahValley.rb’s April meeting, we decided to set up an informal study group to work through <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FProgramming-Erlang-Software-Concurrent-World%2Fdp%2F193435600X&tag=urandomthough-20&linkCode=ur2&camp=1789&creative=9325">Programming Erlang</a><img src="http://www.assoc-amazon.com/e/ir?t=urandomthough-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />—several of us already have the beta book.</p><br /><br /><br /><p>I don’t know if we’ll start on the first or the fifteenth of May, but I <strong>do</strong> know it will be fun. I’ll plan on posting about them here.</p>gnupatehttp://www.blogger.com/profile/10492341480170667775noreply@blogger.com0tag:blogger.com,1999:blog-2701628522441228496.post-69651503036043272492007-04-18T07:15:00.000-07:002007-04-18T07:17:01.840-07:00Getting to know erlang-mode<p>The very first errata listed for the beta <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FProgramming-Erlang-Software-Concurrent-World%2Fdp%2F193435600X&tag=urandomthough-20&linkCode=ur2&camp=1789&creative=9325">Programming Erlang: Software for a Concurrent World</a><img src="http://www.assoc-amazon.com/e/ir?t=urandomthough-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> is that Joe should include a chapter on erlang programming tools, and it specifically mentions <tt>erlang-mode</tt> for emacs. Being an emacs user, this piqued my interest and I went off in search of it. Here's a quick run-down of what I found.</p><br /><br /><h2>Installing and Running <tt>erlang-mode</tt></h2><br /><br /><p><tt>erlang-mode</tt> is part of the OTP erlang distribution, although it's kind of hidden. Since I compiled and installed my distribution in the /usr tree, All my examples will point there. Even though the needed elisp files are installed and easy to get runing, you'll need to download and install the erlang man pages. I put them in /usr/lib/erlang on my system.</p><br /><br /><p>Once the code and documentation is installed, you can set it up by adding the following elisp code to your <tt>.emacs</tt> file:<br /><pre><code lang="elisp"><br />;; setup erlang mode<br />;; add the location of the elisp files to the load-path<br />(setq load-path (cons "/usr/lib/erlang/lib/tools-2.5.3/emacs"<br /> load-path))<br />;; set the location of the man page hierarchy<br />(setq erlang-root-dir "/usr/lib/erlang")<br />;; add the home of the erlang binaries to the exec-path<br />(setq exec-path (cons "/usr/lib/bin" exec-path))<br />;; load and eval the erlang-start package to set up <br />;; everything else <br />(require 'erlang-start)<br /></code></pre><br />(Feel free to strip out the comments, They aren't in my .emacs file either.)<br /></p><br /><br /><h2>First Impressions</h2><br /><br /><p>The first thing that I found to like about <tt>erlang-mode</tt> was the ability to run an erlang shell inside emacs. Since I like to play in a REPL while I program, having a shell running inside my editor is great. While I normally have my emacs running much larger than this, I wanted to show a full-sized screenshot so you could read the text. Working this way just rocks!</p><br /><br /><p align="center"><img src="http://www.red-bean.com/~pate/erlang-mode.png" alt="Picture of an emacs session with the erl shell and syntax highlighting"></p><br /><br /><p>The screenshot above also shows off <tt>erlang-mode</tt>'s syntax highlighting. There are four levels of syntax highlighting ranging from off to 'Christmas Tree Mode' (which is the highlighting level I run in).</p><br /><br /><p>Another thing that leaped out at me, was the auto-formatter/indenter that's built into <tt>erlang-mode</tt>. It was a little bit strange to be typing along and hit an arrow (<tt>-></tt>) only to have emacs automagically move to the next line and indent for me. I got used to it in a couple of minutes, and realized that I could get to like it — if I felt like it was using good style, it doesn't match up against the example in <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FProgramming-Erlang-Software-Concurrent-World%2Fdp%2F193435600X&tag=urandomthough-20&linkCode=ur2&camp=1789&creative=9325">Programming Erlang: Software for a Concurrent World</a><img src="http://www.assoc-amazon.com/e/ir?t=urandomthough-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />. Anyone want to weigh in on how good or bad it looks?<br /><pre><code lang="erlang"><br />qsort([]) -><br /> [];<br />qsort([Pivot|T]) -> <br /> qsort([X || X <- T, <br /> X < Pivot]) <br /> ++ [Pivot] ++ <br /> qsort([X || X <- T,<br /> X >= Pivot]).<br /></code></pre><br />(By the way, it also automatically creates an indented, new line in a lot of cases. I'm not quite sure what all of them are yet.)</p><br /><br /><p>Since I'm on the topic of code formatting, I thought I'd toss out several small but interesting functions.<ul><br /><br /><li><tt>erlang-align-arrows</tt> (<tt>C-c C-a</tt>): I think that well used whitespace can make reading a program easier, and aligning similar parts of a program is one example. Running <tt>erlang-align-arrows</tt> against this region:<br /><pre><code lang="erlang"><br />for(Max, Max, F) -> [F(Max)];<br />for(I, Max, F) -> [F(I)| for(I+1, Max, F)].<br /><br />sum([H|T]) -> H + sum(T);<br />sum([]) -> 0.<br /><br />map(_, []) -> [];<br />map(F, [H|T])-> [F(H) | map(F, T)].<br /></code></pre><br />will reformat it to look like this:<br /><pre><code lang="erlang"><br />for(Max, Max, F) -> [F(Max)];<br />for(I, Max, F) -> [F(I)| for(I+1, Max, F)].<br /><br />sum([H|T]) -> H + sum(T);<br />sum([]) -> 0.<br /><br />map(_, []) -> [];<br />map(F, [H|T]) -> [F(H) | map(F, T)].<br /></code></pre></li><br /><br /><li><tt>erlang-generate-new-clause</tt> (<tt>C-c C-j</tt>): This command (and the next one) will likely save some typing. It generates a new clause in the curent function, immediately below the current clause, and puts the point at the argument list inside the parens. For example, running <tt>erlang-generate-new-clause</tt> with the point on the rectangle clause of the following function:<br /><pre><code lang="erlang"><br />area({rectangle, Width, Ht}) -> Width * Ht;<br />area({circle, R}) -> 3.14159 * R * R;<br />area({square,X}) -> geometry:area({rectangle, X, X}).<br /></code></pre><br />will create:<br /><pre><code lang="erlang"><br />area({rectangle, Width, Ht}) -> Width * Ht;<br />area() -><br />area({circle, R}) -> 3.14159 * R * R;<br />area({square,X}) -> geometry:area({rectangle, X, X}).<br /></code></pre><br />One small gotcha is that there's no closing punctuation for the generated clause, so you'll need to type your own semicolon or period.<br /></li><br /><br /><li><tt>erlang-clone-arguments</tt> (<tt>C-c C-y</tt></tt>): This command will insert the arguments from the previous clause at the current point. If you run it immediately after the <tt>erlang-generate-new-clause</tt> command above, you'll the new clause will be changed to read:<br /><pre><code lang="erlang"><br />area({rectangle, Width, Ht}) -><br /></code></pre><br />which would be easy to edit to create a triangle clause.<br /></ul></p><br /><br /><p>One set of commands I didn't play with were the compilation commands. Once I get to that section of <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FProgramming-Erlang-Software-Concurrent-World%2Fdp%2F193435600X&tag=urandomthough-20&linkCode=ur2&camp=1789&creative=9325">Programming Erlang: Software for a Concurrent World</a><img src="http://www.assoc-amazon.com/e/ir?t=urandomthough-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />, I'm sure I'll dig back in — I'll plan on writing another post about <tt>erlang-mode</tt> then.</p><br /><br /><p>I hope this was useful. I think I'll be spending a fair amount of time in <tt>erlang-mode</tt>, so I plan on getting comfortable here. Happy hacking!</p>gnupatehttp://www.blogger.com/profile/10492341480170667775noreply@blogger.com0tag:blogger.com,1999:blog-2701628522441228496.post-39426459411050712162007-04-17T14:04:00.000-07:002007-04-17T14:05:22.593-07:00Why<p>Ok, so I've settled on Erlang as the functional language I'm going to study this year. I'm not really going to jump in until May, but I'll play in the wading pool until then.</p><br /><br /><p>I'll be using <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FProgramming-Erlang-Software-Concurrent-World%2Fdp%2F193435600X&tag=urandomthough-20&linkCode=ur2&camp=1789&creative=9325">Programming Erlang: Software for a Concurrent World</a><img src="http://www.assoc-amazon.com/e/ir?t=urandomthough-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> as my study guide, along with any good looking blogs/websites I track down while I'm working on it. I've already seen Dave Thomas' two posts on Erlang (<a href="http://pragdave.pragprog.com/pragdave/2007/04/a_first_erlang_.html">A First Erlang Program</a> and <a href="http://pragdave.pragprog.com/pragdave/2007/04/adding_concurre.html">Adding Concurrency to Our Erlang Program</a>) and <a href="http://yarivsblog.com/">Yariv Sadan's blog</a> looks good too. If I'm missing some good blogs/resources, please, let me know.</p><br /><br /><p>I'll track my progress here. Don't expect any whiz-bang results right away, but hopefully it will be both interesting and useful (at least to other Erlang newbies out there).</p>gnupatehttp://www.blogger.com/profile/10492341480170667775noreply@blogger.com0tag:blogger.com,1999:blog-2701628522441228496.post-9036660966478001592007-04-17T13:49:00.000-07:002007-04-17T13:50:19.574-07:00Erlang and Haskell Books: First Impressions<p>I recently picked up a beta copy of <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FProgramming-Erlang-Software-Concurrent-World%2Fdp%2F193435600X&tag=urandomthough-20&linkCode=ur2&camp=1789&creative=9325">Programming Erlang: Software for a Concurrent World</a><img src="http://www.assoc-amazon.com/e/ir?t=urandomthough-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> to go along with my (paper) copy of <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FProgramming-Haskell-Graham-Hutton%2Fdp%2F0521692695&tag=urandomthough-20&linkCode=ur2&camp=1789&creative=9325">Programming in Haskell</a><img src="http://www.assoc-amazon.com/e/ir?t=urandomthough-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />. I figured if I had both books, I could make quick runs through them as I try to decide between Haskell and Erlang as the FP language I'm going to focus on this summer. What follows isn't really a review of either book, just a few first impressions.</p><br /><br /><iframe src="http://rcm.amazon.com/e/cm?t=urandomthough-20&o=1&p=8&l=as1&asins=193435600X&fc1=000000&IS1=1<1=_blank&lc1=0000FF&bc1=FFFFFF&bg1=FFFFFF&f=ifr&npa=1" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe><br /><br /><p><a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FProgramming-Erlang-Software-Concurrent-World%2Fdp%2F193435600X&tag=urandomthough-20&linkCode=ur2&camp=1789&creative=9325">Programming Erlang: Software for a Concurrent World</a><img src="http://www.assoc-amazon.com/e/ir?t=urandomthough-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> looks like to be a very accessible book, that also goes into enough depth to be worthwhile. The version I got yesterday had 279 pages in the PDF, but an update was released today and my new copy hasn't found it's way here yet. I like what I've read of Joe Armstrong's writing and examples, and have caught on quickly to the initial concepts.</p><br /><br /><iframe src="http://rcm.amazon.com/e/cm?t=urandomthough-20&o=1&p=8&l=as1&asins=0521692695&fc1=000000&IS1=1<1=_blank&lc1=0000FF&bc1=FFFFFF&bg1=FFFFFF&f=ifr&npa=1" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe><br /><br /><p><a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FProgramming-Haskell-Graham-Hutton%2Fdp%2F0521692695&tag=urandomthough-20&linkCode=ur2&camp=1789&creative=9325">Programming in Haskell</a><img src="http://www.assoc-amazon.com/e/ir?t=urandomthough-20&l=ur2&o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> surprised me by being <em>really</em> small, only 171 pages (including the index). It on the scale of 'The C Programming Language', and so far it reminds me a lot of that book. I have to admit though, that I've always been put off by the seeming need of Haskell writers to use 'special Haskell characters' in their text, Programming Haskell even includes a table of 15 such symbols and how to represent them in ASCII. Bleargh!</p><br /><br /><p>So far, I'm leaning towards Erlang (mostly because of concurrency), but I'm not going to make up my mind for a while yet — too many other deadlines I need to deal with right now. As I get closer to the summer, I'll let you know which way I decide to go. (I'll also get real reviews of the two books up fairly soon.)</p>gnupatehttp://www.blogger.com/profile/10492341480170667775noreply@blogger.com0