I'm enjoying the lectures a lot (the two so far). He's a great speaker (is's quite fun to attend classes) and he managed to explain the basic concepts of concurrent erlang programming in 2 hours (provided you already knew the basic erlang syntax).
I'm taking some notes at class, and I'll eventually clean them and upload them in a blogpost format.
For the moment, here is a silly code I wrote the other day while I was in the bus.
It's interesting how:
- Concepts learnt previously in scheme and perl (Higher Order Perl ftw!) become useful and appliable here.
- Pattern matching is stressed to become the basis of method dispatch (with or without guards), variable binding, if/case/any_conditional and message receiving.
- The Message Passing system is GREAT. Not just the "forget about low level sockets" but the mailbox
system of each process, and the transparency that frees you from thinking low level.
- Being a functional language, it does tail call optimization, and in most cases you better take advantage of it, because processes (if you think of them as DFA's) have a long life, and they just travel from one state to other by calling themselves recursively with an updated argument (you can
pass the state along through the function arguments).
Here's the code. Just a Proof of concept. Two processes sending pings and pongs one to the other. Pretty simple, but there's pretty much a synopsis of the erlang (ugly) syntax and expressions.