Sign up ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

I'm trying to learn more about Erlang than the toy projects I've been playing with. To this end, I'm reading through Programming Erlang and some of the archives from Armstrong on Software.

I would also like to read over some example (preferably production) code that showcases the sorts of things you can build with Erlang that would be disproportionately difficult in other languages. Aside from (I assume) Yaws, are there any publicly available examples of beautiful Erlang code that I could read through to gain a better understanding of the language and/or see the idiomatic uses for various language constructs?

I'm specifically not looking for code that "gets the job done" but uses questionable practices, or examples along the lines of "here's how you write factorial in Erlang".

In the same vein, can anyone recommend any good literature for learning this language (other than the mentioned "Programming Erlang")? For preference, something you yourself used to learn it, but if there's some community standard books for it, throw those in too.

share|improve this question

closed as off-topic by Ixrec, Snowman, GlenH7, durron597, jwenting May 17 at 9:52

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Ixrec, Snowman, GlenH7, durron597, jwenting
If this question can be reworded to fit the rules in the help center, please edit the question.

Erlang was created by Ericcson to design and build massively parallel switches for phone traffic. It was designed by Ericsson to support distributed, fault-tolerant, soft-real-time, non-stop applications. That is the problem domain in which it excels. For all other problem domains...Your mileage may vary. – Robert Harvey Nov 9 '10 at 19:55

2 Answers 2

up vote 6 down vote accepted

Another good reference is Erlang and OTP in Action.

About the code samples: it is kind of hard to find best practices for Erlang, but I would suggest you try these websites:

Check the links from this article (open source software written in erlang) and you might find interesting code.

share|improve this answer
+1 for Erlang and OTP in Action. – edwardw Dec 8 '11 at 6:05

Since you added the tag functional-programming, how about writing an Erlang compiler or interpreter in Haskell? Erlang is not quite state-of-the-art anymore, like at all. I recommend to learn Erlang in one or two days, like some other languages (LISP, Prolog), and then to forget about them; they are just a step to unlearn imperative OOP-languages.

For smaller tasks than implementing a compiler, see Project Euler.

[EDIT] To answer the comment:

From a technical view: Erlang was good in the old days, when there weren't multicore-processors. But now –given the existing compilers/interpreters I am arare of– it just does not scale anymore like it should. An interpreter written in Haskell would scale, compiled to Haskell would make it faster but would remove the on-the-fly code-replacing feature.

From the Programmers' view: Haskell is not for all applicable tasks the best choice, but atm, the probably more advanced languages are very experimental, and those not applicable tasks have usually sth to do with either embedded systems (like microcontrollers and GPUs) or numbercrunching, where C and Assembler are still the best choice.

What exactly is something that you could do with Erlang better than in other languages?

share|improve this answer
I didn't make a claim to be learning it because it was state-of-the-art; I just think it looks interesting, and there might be things you can build with it that you can't easily with other languages. If your answer is "Haskell is a better choice for all applicable tasks", how about telling me why specifically (instead of just asserting it vaguely), and answering the initial question for Haskell instead of Erlang? – Inaimathi Nov 7 '10 at 22:12
I don't know that this answer is that bad, though it does skirt right around the original question. If you'd like to see some lovely Haskell in the sense that comanad is talking about, look at Its a tutorial that teaches haskell, the parsec parsing library, and and scheme by writing a scheme parser. Parser combinators are, I feel, one of the more beautiful things to play with in functional languages. They're a bit practical too; once you know how to write parsers, you can design your own languages to solve specific problems. – CodexArcanum Nov 8 '10 at 21:26
"What exactly is something that you could do with Erlang better than in other languages?" I don't know; that's why I'm trying to learn it. My gut tells me that a language whose principal construct is the process (as opposed to the closure as in CL, the lambda as in Scheme or the dictionary as in python) would have something interesting to offer. Haskell is functional too, and it has similar pattern matching constructs, but there isn't a relentless focus on concurrency. In fact, the principal construct in Haskell seems to be the type, which makes me think they're very different animals. – Inaimathi Nov 8 '10 at 21:41
@CodexArcanum - AFAIK, Erlang and OTP are available under a derivative of the Mozilla Public License, and it is free-as-in-beer from the Debian repos. What did you mean by "the system is proprietary"? – Inaimathi Nov 8 '10 at 21:45
@comonad - What I meant by "Haskell is a better choice for all applicable tasks" was "For every task that I could complete acceptably with Erlang, Haskell can do it better". I didn't mean to imply that you could do all programming work with a single language, or that I was looking to use only one language for all my projects. You seemed to be asking "Why use Erlang when you can use Haskell?", which implies that you think Haskell is directly superior. I wanted you to clarify and perhaps support that claim. – Inaimathi Nov 8 '10 at 21:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.