Slashdot Mirror


Programming Erlang

gnalre writes "Every day it seems there is a new publication of a book on perl/python/ruby. Some languages however do not seem to get that sort of attention. One of those under-represented languages is Erlang, however for the first time in 10 years a new Erlang book has been published. As someone who had a brief flirtation with Erlang long ago, I was interested to see how the language had evolved in the intervening decade. I was also curious to re-evaluate Erlang to see what solutions it offered to the present day issues of writing reliable distributed applications." Read on for the rest of Tony's review. Programming Erlang - Software For A Concurrent World author Joe Armstrong pages 515 publisher The Pragmatic Programmers rating 8/10 reviewer Tony Pedley ISBN 1-9343560-0-X summary Parallel programming the easy way

Programming Erlang — Software For A Concurrent World (ISBN 10193435600X) is part of the pragmatic programmer series. As with all the books in this series, it is available in paperback or for a reduced cost you can directly download it in PDF format (which is always useful if you spend a lot of time on the move and you do not like carrying around a dead tree with you). The book's format and layout as with all the books of this series are clear and logical.

The book is written by Joe Armstrong, who co-authored the first Erlang book a decade ago. He was also one of the originators of the Erlang language and has been directly connected to its development ever since. We can therefore be assured about the author's knowledge and insight into the language, if not his impartiality.

The book itself can be roughly split into three main sections: Getting started and Sequential programming, Concurrent Programming and Erlang libraries and advanced Erlang techniques.

In Chapter 1 the author sets out his stall of why Erlang is worthy of your attention. It's clear from this chapter that the author feels Erlang's strength lies in applications requiring an element concurrency and fault tolerance. Another emphasis is made of running Erlang on modern multi-core processors, something that was only a glint in a hardware designer's eye 10 years ago, but is rapidly becoming an issue in all areas of programming. From this chapter you also get a feel on how the author approaches his programming in that he states that he wants the reader to have fun with the language, which is a refreshing change to some language text books whose main purpose appears to be as a cure for insomnia.

Chapter 2 goes through installing Erlang and the Erlang shell (a command line environment similar to ones with languages such as perl). The chapter also starts us into the strange world of functional programming, where variables can only be given a value once (e.g you cannot do i=i+1), recursion replace loops and pattern matching replaces assignments. Fortunately the Erlang language is remarkably concise. For example there are only 4 data types. However to those coming from a purely procedural programming background the learning curve could be a steep one. Saying that the Author does a good job of leading you through the languages intricacies with examples being compared to code from languages such as Java to help keep your feet on solid programming ground.

The next 3 chapters move on to writing simple Erlang programs. As a quick aside, for anyone new to Erlang it is well worth examining the quicksort implementation described in chapter 3. Its conciseness and simplicity was one of the reasons the language won me over when I first met the language.

These chapters also cover error detection and handling. It's worth noting that Erlang has a philosophy of ensuring programs fail hard, so that bugs can be weeded out at an early stage. This idea very much defines how Erlang error handling is defined.

One criticism of the first section is Chapter 6, which describes compiling and running an Erlang program. I would have preferred that this information be covered earlier in the book or be placed in an appendix because it is probably an area you will want to reference repeatedly.

Chapter 7 is where things really get interesting and the true power of Erlang starts to come to the fore. This is where Erlang's concurrency credentials are explained. This chapter begins by providing some useful metaphors of the Erlang concurrent model, but chapter 8 is where the fun begins by describing the Erlang concurrency primitives that allow the creation of processes and the process communication methods. The author here highlights one of the language features, the Erlang light weight process. These are true processes (not threads) but take up very little in the way of resources. Indeed it is not unusual to have 1000's of such processes running in an application.

The next few chapters expand on the available concurrency primitives and how to move from concurrency on your local processor to concurrency utilizing the resources of multiple machines either on a local network or across the web. It finishes the section off by showing the example of a simple IRC application.

Chapter 12 starts the next section by looking at how to interact with the world outside the Erlang environment. First it examines how to interface an Erlang program to applications written in other languages such as C. It then goes onto to look at file and socket handling in Erlang. Chapter 15 looks at two important Erlang storage primitives ETS and DETS before we get to the OTP Erlang libraries in Chapter 16.

The OTP libraries are the standard Erlang libraries and tools. In fact the OTP libraries are worthy of a book in itself. The author highlights the section on the generic Server module as the most important section in the whole book and one to be reread until its importance has sunk in. This is because here are encapsulated many of the lessons learned in writing industrial fault-tolerant applications, such the updating of a running applications code without causing that application to miss a beat. The section is finished off by describing the Erlang distributed database (humorously named Mnesia) and then finishing it off with the example of a simple server application.

The book finishes off by looking at Erlang on multicore systems including its support for SMP. As the author states this is the leading edge of present day Erlang and is still under development.

I would like to thank the pragmatic programmers for publishing this book. Erlang's profile has been in need of highlighting for many years and hopefully this book will help. The book definitely provides a great starting point for anyone who wants to get to grips with the language and takes them to the point where they can start writing useful applications. This book is a worthy successor to the last book published and does a good job of both updating the material and explaining some of the later developments such as SMP. Anyone who has a need for writing fault tolerant applications should at least look at this book. If nothing else you will never be afraid of dealing with recursion ever again.

In many ways the book cuts off just when things are getting interesting. There are hints in the book about real world Erlang's applications and it would have been good if some of these experiences could have been expanded. Hopefully this book is the start of increased exposure for Erlang. If so then someone may get around to writing another Erlang book describing some of the advanced issues about generating robust applications. I just hope it won't take another 10 years this time.

Tony Pedley is a senior engineer specializing in real-time embedded systems. In his spare time he likes to tease windows programmers and confuse managers by telling them it would be a lot easier if we wrote it in Erlang.

You can purchase Programming Erlang - Software For A Concurrent World from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

314 comments

  1. Can you say by hax0r_this · · Score: 0, Offtopic

    Dupe?

    1. Re:Can you say by hax0r_this · · Score: 0, Offtopic

      Ok, I can't find it, but I would swear to my nonexistant god that this was posted about a week and a half ago.

  2. Try it out by romiz · · Score: 5, Informative

    The first chapter is avalable online to get a taste of the book (and the language).

    1. Re:Try it out by aminorex · · Score: 0

      The article reads

      > This book is a worthy successor to the last book published

      which would imply that this book should *never* be published. Yet now I learn that [the first chapter
      of [the successor of [the last book]]] is already available as a pre-print? Methinks my Peano is out of tune.

      --
      -I like my women like I like my tea: green-
    2. Re:Try it out by suv4x4 · · Score: 0, Redundant

      The first chapter is avalable online to get a taste of the book (and the language).

      Right.. sot he first chapter goes on an on how hot it is that once you assign a value to a variable, it can no longer be changed. You see, that's super hot, since you can assign Pi = 3.14 and then you can't change it.

      But unlike constants those single-assignment vars can't be optimized at compile time, and still can't replace normal variables.

      All in all, no wonder the language isn't popular. We're way way past drastic differences in the languages we'll use. We're stuck with C/Java like syntax, OOP and anything new regarding concurrency will be rolled up on top of it, versus replace it.

      There are mountains of code out there in C-like languages that needs to be reused.

      I believe concurrency will in the end be most implemented via RAM transactions, which proves a simple and effective model for handling race conditions, while retaining the look of the separate procedures as imperative sequential code as we know it today.

    3. Re:Try it out by jhantin · · Score: 1

      Right.. sot he first chapter goes on an on how hot it is that once you assign a value to a variable, it can no longer be changed. You see, that's super hot, since you can assign Pi = 3.14 and then you can't change it.

      It's called static single assignment form. It's arguable whether requiring the programmer to write in this formal style is better than letting the compiler convert the code though -- sort of like the holy war over manifest versus inferred types.

      I believe concurrency will in the end be most implemented via RAM transactions, which proves a simple and effective model for handling race conditions, while retaining the look of the separate procedures as imperative sequential code as we know it today.

      Software transactional memory is nifty, and there are implementations like SXM for .Net by Maurice Herlihy, but the bizarre contortions required to get between an object and its fields at runtime (in SXM's case, wrapping all fields in properties and using a runtime-generated subclass that overrides the setters and getters to monitor the transaction) feel more unnatural to me than SSA form.

      --
      ...when you're writing a game...tweak the difficulty of "Easy" to something [your mother] can cope with. -- onion2k
    4. Re:Try it out by Chandon+Seldon · · Score: 1

      All in all, no wonder the language isn't popular. We're way way past drastic differences in the languages we'll use. We're stuck with C/Java like syntax, OOP and anything new regarding concurrency will be rolled up on top of it, versus replace it.

      Assuming that Java/C# are the last word in programming language behavior is simply foolish. Sure, they're popular today. Sure, people will still be using them in 30 years (in the same way that people are still using Cobol today). But they'll get replaced just like every "best" language before them.

      But unlike constants those single-assignment vars can't be optimized at compile time, and still can't replace normal variables.

      Have you ever actually written a program in a functional language? If not, I suggest you do. The design patterns involved are extremely elegant and frequently useful even in procedural programming languages.

      I believe concurrency will in the end be most implemented via RAM transactions, which proves a simple and effective model for handling race conditions, while retaining the look of the separate procedures as imperative sequential code as we know it today.

      Transactional memory is neat, but I haven't seen a model for it described that actually makes concurrent programming straightforward for the programmer. Erlang style message passing, on the other hand, has been actually working in production for a very long time.

      --
      -- The act of censorship is always worse than whatever is being censored. Always.
    5. Re:Try it out by suv4x4 · · Score: 1

      Assuming that Java/C# are the last word in programming language behavior is simply foolish. Sure, they're popular today.

      I didn't assume they're the last word, Erlang isn't either though. I said they're used a lot and we're stuck with them.

      The deduction that they'll be replaced like anything before them isn't good though: computer technology was young before. Now it costs millions to port the vast amount of code written and interconnected with other code, to something else.

      There are companies still out there stuck with COBOL. The same effect with massively increased power will become apparent for C/Java/C#/PHP/Python and what not code in 10-20 years. We're stuck with it.

    6. Re:Try it out by chromatic · · Score: 2, Insightful

      It's a bit rude to the authors and publishers to post copyrighted material on the Internet without their permission. The last I checked, the Pragmatic Bookshelf e-books used no DRM, so it's not like they're treating legitimate customers poorly either.

    7. Re:Try it out by Chandon+Seldon · · Score: 1

      There are companies still out there stuck with COBOL. The same effect with massively increased power will become apparent for C/Java/C#/PHP/Python and what not code in 10-20 years. We're stuck with it.

      It's natural that software maintenance will never be in new languages. That doesn't prevent new projects, or even new components in existing projects, from being written in those new languages. One thing that's happened that's very interesting is systems like .NET being designed to support the easy intermingling of different languages in the same application. That will allow projects to migrate to new languages more easily, and for niche languages to be used for specific modules where they are appropriate. Sure, PHBs will continue to try to force every project to be written in one (usually inappropriate) language, but even today we see major apps written in Python & C++ or C# & VB.NET or C++ & JavaScript.

      --
      -- The act of censorship is always worse than whatever is being censored. Always.
    8. Re:Try it out by Brummund · · Score: 5, Funny

      Authors should give away their books, and instead earn their money giving seminars and lectures.

      And, as I'm told, earn top dollar from merchandise like t-shirts, mouse pads and coffee mugs.

    9. Re:Try it out by Doctor+Memory · · Score: 1

      the bizarre contortions required to get between an object and its fields at runtime (in SXM's case, wrapping all fields in properties and using a runtime-generated subclass that overrides the setters and getters to monitor the transaction) feel more unnatural to me than SSA form. Isn't that roughly what Ruby does, invoking an implicit accessor function if one hasn't been explicitly supplied? And I know that some commercial Java products use reflection and bytecode injectors to intercept attribute accesses, which requires no (manual) modification of the baseline code.

      I'm not familiar with SXM, but based on what I've seen elsewhere it doesn't sound like it uses a terribly unworkable approach. That said, I have more of a desire to play with Erlang than SXM or other transactional memory approaches.
      --
      Just junk food for thought...
    10. Re:Try it out by Bill+Dog · · Score: 1

      It's natural that software maintenance will never be in new languages. That doesn't prevent new projects,...

      Yes, it does, because it's for the exact same reason -- economics. It's too costly, in time/money, to train developers in a drastically different language. The days of difficult but powerful languages and other technologies (like CORBA, COM, prolly others) achieving mainstream status are over. That's why C++ is being replaced with Java and C#. Anything hard is undesirable by PHB's. As is anything drastically different.

      Why was VB massaged into a C/C++-like language? PHB's want it all to be basically the same, and relatively idiot-proof, so they can start managing software like they really want to, like they were taught in business school that they could manage anything as, and that is like widget production. Developers should be inexpensive, interchangeable resources, so they must all be relatively on the same page, and they should crank out modules that any other inexpensive developer should be able to take over.

      That is the PHB's holy grail -- they want simplicity and familiarity and predictability, not greater risk (no matter the promised returns), complexity, and expense. Java wouldn't have gone anywhere if it had not borrowed so much from C and C++ syntax and familiar concepts, enabling people to jump over to it with only a small learning curve. Same for C#. And is the trend for there to be more for the programmer to manage and think about, or less? I think suv4x4 is basically right, we're stuck with the C syntax, OOP, and any advancements such as in the area of more concurrency will only catch on big if it is handled automatically for the developer, by the runtime.

      --
      Attention zealots and haters: 00100 00100
    11. Re:Try it out by poopdeville · · Score: 1

      But unlike constants those single-assignment vars can't be optimized at compile time, and still can't replace normal variables.

      Red herring. Single Static Assignment introduces an entire class of possible optimizations to code structure. But the compile time optimizations you mention are designed to put the constants in SSA form so that SSA form optimizations can be carried out. GCC uses SSA form internally a lot.

      Functional language variables are strange. They're essentially a part of the environment, not a part of the program. Use them like you would environment variables and you'll be fine. Writing an OO framework in a functional language is pretty easy (that's what they were designed for in the first place). So maintaining state (locally) is possible.

      --
      After all, I am strangely colored.
    12. Re:Try it out by antek9 · · Score: 1

      Oh dear, help! As much as I like grammar nazis and spelling nazis, but now we also get semantics nazis here on slashdot?

      Yeah, I know. I must be new here.

      --
      A World in a Grain of Sand / Heaven in a Wild Flower,
      Infinity in the Palm of your Hand / And Eternity in an Hour.
    13. Re:Try it out by Chandon+Seldon · · Score: 2, Interesting

      Yes, it does, because it's for the exact same reason -- economics. It's too costly, in time/money, to train developers in a drastically different language. The days of difficult but powerful languages and other technologies (like CORBA, COM, prolly others) achieving mainstream status are over. That's why C++ is being replaced with Java and C#. Anything hard is undesirable by PHB's. As is anything drastically different.

      You are right on reasonably short time scales (a year or two) at a single organization. On longer time scales, new languages do get used and new programming teams are hired / trained to use them. Consider the adoption of C#. A couple years ago, there were zero C# developers in the world - today, it's mandated by many PHB's.

      Sure, more drastically different languages take longer to be adopted. Consider how the adoption of OO programming languages occured in the late 80's and 90's. First, hybrid languages like C++ were created. Then, once C++ had already been adopted, we got stuff like Java. Today, OO is mainstream. I fully expect that any uptake of functional programming will occur the same way - with transitional languages and years of advance warning.

      I think suv4x4 is basically right, we're stuck with the C syntax, OOP, and any advancements such as in the area of more concurrency will only catch on big if it is handled automatically for the developer, by the runtime.

      This will be interesting to watch. It looks to me like we'll get to 32 cores in a high end workstation (and 8 - 16 in a moderate desktop) before anyone seriously questions buying more cores any more than they already question buying faster hardware in general and that programmers are going to be suffering with locks and threads for a long time. If something significantly better comes along in the form of a new language, people may adopt it - the business case for saving programmer time and using existing hardware better is damn good. Erlang isn't that language for various reasons, but some sort of Erlang/Ruby or Erlang/Java hybrid might be.

      --
      -- The act of censorship is always worse than whatever is being censored. Always.
    14. Re:Try it out by Anonymous Coward · · Score: 0

      Regarding Ruby: Unless you either do either class A; attr_accessor :symbol; end; or class A; def symbol; return symbol; end; end;, calling symbol on an instance of A will fail to do what you intend.

    15. Re:Try it out by Anonymous Coward · · Score: 0

      Duh, missing sigil in the second snippet: class A; def symbol; return @symbol; end; end;.

      Note that attr_accessor is an instance method for class Module (of which individual classes are instances). So depending on your point of view, it's either a class method or an instance method. Either way, code similar to the second example gets executed.

    16. Re:Try it out by mrvan · · Score: 1

      1) isn't this up to the author - to decide how he wants to make a living from his profession?

      2) this might be true for a top 5% of authors (who aren't doing to bad anyways), but if your book would only sell a couple (ten) thousand copies [as I think a lot of academic books do] , do you really think selling coffee mugs is going to make a killing???

    17. Re:Try it out by sven.schoenung · · Score: 1
    18. Re:Try it out by Weedlekin · · Score: 1

      The parent was humorously paraphrasing the standard Slashdot advice to software writers and musicians from people who want to pretend that they're doing content producers a favour by copying their work without permission, e.g.:

      Software should be given away, and those who write it should make money from selling support.
      Music should be given away, and musicians should make money from touring and merchandising.

      --
      I'm not going to change your sheets again, Mr. Hastings.
    19. Re:Try it out by bomb_number_20 · · Score: 1

      Then s/he could is no longer an author, but a lecturer. At that point, why not say that lecturers should lecture for free and make their money by selling books on the subject(s) they lecture about?

      --
      That's ok, Jesus likes me anyway.
    20. Re:Try it out by Anonymous Coward · · Score: 0

      "Authors should give away their books, and instead earn their money giving seminars and lectures."

      What if they are programmers who are giving away their code and trying to make money off of the books that they write?

    21. Re:Try it out by DaveTerrell · · Score: 1

      The company I work for just started evaluating erlang in june. we're going to release our first successful product in a month and the second is already in the pipeline.

      If you have good developers who are interested in learning something new and a problem that fits the domain for which erlang excels, it's not a steep learning curve at all.

    22. Re:Try it out by Cafe+Alpha · · Score: 1

      Yes, I guess you can do more whole-program optimizations if you use only or mostly single assignment variables, but this strikes me the way FORTH did - making the programmer write directly in compiler intermediate form because the language implementer was too inexperienced to know how to write a real compiler.

    23. Re:Try it out by Cafe+Alpha · · Score: 1

      Oops, I forgot, the single assignment property can be useful for concurrent data-flow type situations where you trigger an event as soon as the data is ready or as a combination of lock and data, once again for the sake of concurrency.

    24. Re:Try it out by Anonymous Coward · · Score: 0

      This sounds exactly backwards to me. Lisp is a much higher level language than C, for example. In Lisp, you don't care how a function is computed. You give the interpreter or compiler enough information to figure it out. Lisp's conceptual model does not need variables that vary within a lexical scope. Indeed, it almost requires variables that stay constant in a scope, just as in mathematics.

    25. Re:Try it out by Cafe+Alpha · · Score: 1

      Uhm, Lisp doesn't even HAVE single assignment variables. I don't think you understood what I was referring to.

    26. Re:Try it out by poopdeville · · Score: 1

      Evidently not. I was talking about functional programming languages and SSA. You interjected and said (paraphrasing) that "it" strikes you as backwards, like forth. Lisp has SSA variables, by the way. Scheme does, at least in the context of a single REPL-cycle. This is how Scheme functions get their names. Without the let or define syntactic forms, functions would have to be anonymous.

      --
      After all, I am strangely colored.
  3. Listen up, chappies by Anonymous Coward · · Score: 0

    When the only books about a language are written by the inventor of the language, there is probably a reason. And that reason is: No One Cares.

    1. Re:Listen up, chappies by Skinkie · · Score: 1

      One of the first alternatives as for the 'normal' jabber server implementation was written in erlang. Resulting in ejabberd people care :)

      --
      Support Eachother, Copy Dutch Property!
  4. Great book creation process by DoofusOfDeath · · Score: 3, Informative

    I bought the book while it was still being written. I was able to download drafts, and (if I had the time) submit bug reports. When it was finally done, I got a printed copy in the mail.

    I haven't had much time to play with Erlang (or the book) yet, but it was a really nice feeling to be able to get early access as long as I was willing to see unpolished content. Bravo, publisher.

  5. What's missing from Erlang... by SanityInAnarchy · · Score: 4, Interesting

    Last I checked, there was an implementation issue and a design issue.

    The design issue, for me, was a lack of namespaces. I think it might have been that I can't have an atom with a namespace, beyond prefixing, which is a hack for languages that don't support namespaces.

    The implementation issue was that you had to choose between performance and being able to reload functions later. I would very much like it to be able to JIT or even compile down to binary (x86_64 too, pretty please?), then be able to just leave it running, and have it reload functions as needed.

    I'll have to think of what else I didn't like, but I don't think there was much, aside from some odd syntax. I don't actually have a problem with the somewhat functional nature of it, just certain syntax that looks ugly, but that's a matter of opinion, and something I can live with.

    --
    Don't thank God, thank a doctor!
    1. Re:What's missing from Erlang... by Anonymous Coward · · Score: 0

      Erlang has had modules (namespaces) forever. What are you talking about?

      Check out the HIPE project for a JIT.

      I like Erlang and spent a couple years programming for an OSS Erlang project but my main problem with Erlang is the performance. It's basically crappy enough that you might as well using an even higher level scripting language like Lua or whatever.

    2. Re:What's missing from Erlang... by SanityInAnarchy · · Score: 1

      Erlang has had modules (namespaces) forever. What are you talking about?

      Atoms. They're used for some things I might use constants for in another language, I think. I'll have to get back to you with some code examples.

      Check out the HIPE project for a JIT.

      HIPE is sort of what I was looking for -- I remember BEAM being bad. But I still don't see whether I can dynamically reload HIPE the way I can dynamically reload straight-interpreted stuff.

      As for performance, well, it'll at least thread, without you having to think about it, and as I understand it, they are real threads, which is a big win over Python, for example. But that's what I'm holding out for, is a high-level language with good performance that at least approaches C.

      --
      Don't thank God, thank a doctor!
    3. Re:What's missing from Erlang... by be-fan · · Score: 4, Informative

      But that's what I'm holding out for, is a high-level language with good performance that at least approaches C.

      There's basically a handful of languages that would meet your needs here. On the dynamic side, you've got Common Lisp. On the static side, you've got ML, O'Caml, or Haskell.

      After that, your options trail-off significantly. The other dynamic languages are all much slower than Lisp (more in the league of Python than in the league of C), and the other static languages (C#, Java), are much lower-level/less productive.

      --
      A deep unwavering belief is a sure sign you're missing something...
    4. Re:What's missing from Erlang... by Chandon+Seldon · · Score: 1

      Atoms. They're used for some things I might use constants for in another language, I think. I'll have to get back to you with some code examples.

      Why does it matter if you use the same atom for different things in different places? Would namespaces for atoms even make sense? This seems like a case where you're thinking of them as "replacing constants" rather than "being atoms".

      --
      -- The act of censorship is always worse than whatever is being censored. Always.
    5. Re:What's missing from Erlang... by scott_karana · · Score: 1

      I remember a few releases back Erlang started including "HiPE", which does native and JIT compiling on various architectures, but there is a dearth of information for something so vital and I regret that I can't provide you with a link.

    6. Re:What's missing from Erlang... by pivo · · Score: 1

      > Atoms. They're used for some things I might use constants for in another language, I think. I'll have to get back to you with some code examples.

      Atoms in Erlang don't have a value, so I don't see how you'd use them as constants.

    7. Re:What's missing from Erlang... by SanityInAnarchy · · Score: 1

      Ahem.

      For some things I might use constants for. For example, for passing in flags to functions.

      --
      Don't thank God, thank a doctor!
    8. Re:What's missing from Erlang... by DaveTerrell · · Score: 2, Informative

      You can do reload natively compiled modules. In fact, you can replace a native compiled module with a byte-code one and then vice versa, in a running vm. I just did it 5 seconds ago.

      You can use periods and @s (and anything else) to namespace atoms, if you want. The module loader will even track down module foo.bar to foo/bar.beam... compiler support for it isn't great but it works. nobody bothers to use it though.

      The syntax takes a while to get used to, but it becomes very easy to write.

      What I've found is that the longer I write it, more often I crank out code for hours at a time that just works.

    9. Re:What's missing from Erlang... by pivo · · Score: 2, Informative

      Yes, I understand that. But since atoms in Erlang have no associated value, I don't see how the fact that another module uses the same atom could cause any confusion. Maybe if you gave an example.

      I'm considering Erlang for a project, so I honestly would appreciate knowing how this might be problematic.

    10. Re:What's missing from Erlang... by SanityInAnarchy · · Score: 1

      Well, it might not be problematic at all. I could just be making the whole thing up -- it could be kind of like when a Java programmer criticizes JavaScript for not having interfaces and abstract clasess -- not menaningful for dynamic types.

      --
      Don't thank God, thank a doctor!
    11. Re:What's missing from Erlang... by kripkenstein · · Score: 1

      Just want to mention Vala, a high-level language with C#-like syntax that is compiled into C, so it has quite good performance.

      It looks like an interesting project, albeit an unfinished one. It is also specific to GNOME in that it compiles into C code using GObject.

    12. Re:What's missing from Erlang... by Luna-tic · · Score: 2, Informative
      The implementation issue was that you had to choose between performance and being able to reload functions later. I would very much like it to be able to JIT or even compile down to binary (x86_64 too, pretty please?), then be able to just leave it running, and have it reload functions as needed.

      There is HiPE, which compiles Erlang to native code. And you can HiPE compile modules together with normal BEAM (interpreted code), with function granularity. And then reload the modules using BEAM and/or HiPE, again and again.

      But the reason for commenting your comment was the x86_64 part. HiPE has had x86_64 support for three years now. And its creation made me learn to write the x86_64 machine language in hex...

      Note: I did the x86_64 backend as part of my Master's thesis.
      One relevant paper: http://www.update.uu.se/~luna/papers/ppdp05.pdf

    13. Re:What's missing from Erlang... by Anonymous Coward · · Score: 0

      Look at Lua (www.lua.org).

    14. Re:What's missing from Erlang... by Cafe+Alpha · · Score: 1

      Uhm I don't think you know the meaning of the word "dynamic".

      ML is not a dynamic language, nor is O'Caml. Nor, I think is Haskell.

      They're all called "functional languages" but that's orthogonal to being dynamic (ie, allowing code to change at run time).

      So your list of static languages should have C#, Java, ML, O'Caml & Haskell.

    15. Re:What's missing from Erlang... by be-fan · · Score: 1

      There are a several other languages in the same performance league (Dylan, Clean, etc). However, I was trying to focus on languages one could comfortably use in production. Thus, I limited my suggestions to languages with an official standard, multiple actively-developed implementations, and a decent-sized user community behind them.

      --
      A deep unwavering belief is a sure sign you're missing something...
    16. Re:What's missing from Erlang... by be-fan · · Score: 1

      ML is not a dynamic language, nor is O'Caml. Nor, I think is Haskell.

      That's what I said: "On the static side, you have..."

      They're all called "functional languages" but that's orthogonal to being dynamic (ie, allowing code to change at run time).

      Actually, I was referring more to static versus dynamic typing. Statically-typed languages like ML can have implementations that allow code to change at run-time (SML/NJ).

      So your list of static languages should have C#, Java, ML, O'Caml & Haskell.

      It was a list of high-level languages. C# and Java don't count.

      --
      A deep unwavering belief is a sure sign you're missing something...
    17. Re:What's missing from Erlang... by Cafe+Alpha · · Score: 1

      Oops, somehow my eye skipped "on the static side".

      And I've been thinking lately about dynamic languages in the "code changes" sense and forgot about the other meaning.

      Is there a less confusing way to say "the classes, code etc can change" other than by overusing the word "dynamic"?

      C# is close to being a cool language, but it does have some weirdnesses.

      Closures where the trapped variables are copies, not saved between invocations of the closure. Imagine if you treated objects that way - every method call happens on a fresh copy of the object.

    18. Re:What's missing from Erlang... by damncrackmonkey · · Score: 1

      -define(constant, replacement)

      I may have misread what you're actually looking for. Sorry if that's the case

    19. Re:What's missing from Erlang... by dawsdesign · · Score: 1

      Every instance of a function is a namespace...

  6. Name mixup? by Hoppelainen · · Score: 1

    Perhaps it should have been given another name than a common statistical probability distribution (for some reason people who explore new programming languages are often interested in math and may therefore mix things up)

    http://en.wikipedia.org/wiki/Erlang_distribution

    1. Re:Name mixup? by lederhosen · · Score: 1

      It was created by Ericsson :-)

    2. Re:Name mixup? by mooingyak · · Score: 2, Informative

      It was actually named after the same guy.

      http://en.wikipedia.org/wiki/Erlang_programming_la nguage

      --
      William of Ockham had no beard. The most likely explanation is that it was chewed off by squirrels every morning.
    3. Re:Name mixup? by zolf13 · · Score: 1

      If you ever studied queueing (yes! 4 vowels in a row!) theory then you probably:
      1. know that traffic is measured in Erlangs in channel switching networks
      2. work in telco bussines or other high demand/performace area
      3. know Erlang-B formula by heart
      4. know that software for switching centers is huge
      5. know that switching center is allowed for 5 minutes of downtime a year

    4. Re:Name mixup? by jjrockman · · Score: 1

      I count 5 vowels in a row for the word queueing, but then again I'm just a lowly C# programmer :) /nitpick

      --
      Quit jabbering on the phone while driving. You are not that important.
    5. Re:Name mixup? by zolf13 · · Score: 2, Funny

      Damn... those new programmers are too sharp, now they can count above 3 :)

  7. At the bookstore by CaffeineAddict2001 · · Score: 0, Flamebait

    It shares half a shelf with the Standard ML and Haskell books. The other half taken up by the shrink wrapped "The Art of Computer Programming" that has been sitting on there since the store opened.

    1. Re:At the bookstore by Anonymous Coward · · Score: 0

      Which bookstore near you has ML and Haskell books?? The Barnes and Noble near me recently moved all .NET books into the "Programming" section, with all other programming books like "The C Programming Language" under "Web Development"!

  8. The Seven Deadly Sins of Erlang by MOBE2001 · · Score: 0, Troll
    1. Re:The Seven Deadly Sins of Erlang by Anonymous Coward · · Score: 4, Insightful

      Lets look at these "sins":
      1. Not a sin, not needed and shows you don't know what you're talking about wrt reliability. hard real time is irrelevant.
      2. More FUD based on your lack of understanding of programming.
      3. is a downright lie
      4. Contradicts three!
      5. Ok, now I'm thinking you're not just a troll but verifiably insane. Show us a language (one that exists outside your head) thats not "alkorithmic"
      6. Contradicts itself- is it based on english or is it cryptic?
      7. Asinine in the extreme, and of course contradicted by the other 6 points. erlang is not logo

      Bottom line- you are just making assertions that make no sense. If you ever were a programmer, you never learned much about programming... and your constant bashing of erlang is just an attempt to get attention. COSA doesn't exist, except in your head, where it can be magical and change as is needed for you to make whatever "point" you want to make.

      I guess its a sign that erlang is becomming mainstream that it has attracted a loon such as yourself.

    2. Re:The Seven Deadly Sins of Erlang by Wesley+Felter · · Score: 4, Insightful

      Summary: "Erlang isn't based on my fringe pet theory, so it sucks".

    3. Re:The Seven Deadly Sins of Erlang by Anonymous Coward · · Score: 0

      Did you post that contrarian link in order to add more evidence to my thesis that 99% of blog posts fall in the "worthless or worse" category?

      Disclaimer: I have next to no knowledge regarding Erlang, period, but the "seven deadly sins" were either poorly explained or just plain nonsensical. The algorithmic sin, in particular, made me wonder whether the blog author was involved in the development of INTERCAL.

    4. Re:The Seven Deadly Sins of Erlang by jguthrie · · Score: 4, Insightful

      I often judge the quality of something by looking at the quality of the criticisms of it. If that's the best criticism of Erlang that you can find (or come up with) then Erlang looks pretty damn good. Of course, if you could see your way clear to describing how to write programs without implementing algorithms instead of simply explaining in great detail that algorithmic software is bad, maybe I would find it easier to embrace your view of programming.

    5. Re:The Seven Deadly Sins of Erlang by ibullard · · Score: 2, Informative

      That is the same guy who says you can get artificial intelligence from the bible. He's a loon with a large vocabulary.

    6. Re:The Seven Deadly Sins of Erlang by Anonymous Coward · · Score: 0

      [insert picture of a cracked pot here]

    7. Re:The Seven Deadly Sins of Erlang by webfiend · · Score: 1

      It's just another angry rant, quick to denounce anybody that disagrees. I can get those from deranged street people or by staying on slashdot.

    8. Re:The Seven Deadly Sins of Erlang by MoeDrippins · · Score: 1
      --
      Before you design for reuse, make sure to design it for use.
    9. Re:The Seven Deadly Sins of Erlang by imsabbel · · Score: 1

      Well, thats it.

      The blog you link (especially the authors reactions to criticism in the comments) show that he should really have been aborted when it was still possible.

      --
      HI O WISE PRINCE. WHT TOOK U SO DAM LONG?
    10. Re:The Seven Deadly Sins of Erlang by MOBE2001 · · Score: 0, Troll

      [insert picture of a cracked pot here]

      ahahaha... Funny. This is one crackpot that you're gonna be hearing a lot about from now on. By the way, Erlang has many more sins than the ones listed, though. Did you know that Erlang cannot do fine-grain parallelism? That's right. There is no parallel quicksort algorithm in Erlang. Ooops. It cannot do it. What good is an algorithmic language in a computing world that's moving full speed toward massive parallelism? I just thought I'd mention these things, just to piss off my detractors. ahahaha....

    11. Re:The Seven Deadly Sins of Erlang by rubycodez · · Score: 1

      and his mother shot in the face during the procedure; you just can't be too careful in cases like this

    12. Re:The Seven Deadly Sins of Erlang by Anonymous Coward · · Score: 0

      Well, the nutty description of parallel qsort you have on your site doesn't exist in the real world, so why don't you STFU?

    13. Re:The Seven Deadly Sins of Erlang by iggymanz · · Score: 1

      your detractors are merely laughing at your complete ignorance of computation and your silly worthless pet project, it's doubtful you could do anything to get them actually mad, though your straw man argument about sorts is vaguely annoying.

    14. Re:The Seven Deadly Sins of Erlang by MOBE2001 · · Score: 0, Troll

      and his mother shot in the face during the procedure; you just can't be too careful in cases like this

      The rabid fanaticism of Erlang followers is unparalleled. But hey, Erlang is not parallel either, it just pretends to be. ahahaha... You people remind me of FORTH programmers. Needless to say, both languages suck. ahahaha...

    15. Re:The Seven Deadly Sins of Erlang by MOBE2001 · · Score: 0, Troll

      it's doubtful you could do anything to get them actually mad

      ahahaha... Are you kidding? You guys have been jumping up and down and foaming at the mouth ever since I started writing about how crappy Erlang is. ahahaha... It's entertaining (in an anthropological sort of way), that's for sure. ahahaha...

    16. Re:The Seven Deadly Sins of Erlang by Anonymous Coward · · Score: 0

      ahahaha

      I am totally convinced by your eloquent arguments.
    17. Re:The Seven Deadly Sins of Erlang by rk · · Score: 4, Insightful

      See, here's the thing: I can download Erlang and start to learn it right now. Where can I find COSA? That's right, it's vaporware.

      Who knows, you may be on to something. I'd suggest writing fewer white papers and less name-calling of your detractors and get busy implementing your vision. Nothing will shut them up faster when you've got something that lets people develop systems that are more reliable for no extra cost.

      Until then, you're in the same category as people who promise us perpetual motion machines and anti-gravity levitation.

    18. Re:The Seven Deadly Sins of Erlang by Anonymous Coward · · Score: 0

      Ladies and Gentlemen, what we have here is truly a master of discourse. His typing of "ahahaha..." sure convinced me.

    19. Re:The Seven Deadly Sins of Erlang by Surt · · Score: 1

      Yep, it's definitely all the millions poured into Erlang development and publicity that made it the COSA killer it is today.

      --
      "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
    20. Re:The Seven Deadly Sins of Erlang by sskang · · Score: 1

      From what I understand through a cursory look at your COSA web pages, I get the impression that you are pushing a graphical language that is somewhat like National Instruments' LabVIEW. Have you used LabVIEW? If so, how is it similar/different to your COSA "ideal"?

    21. Re:The Seven Deadly Sins of Erlang by MOBE2001 · · Score: 0, Troll

      Yep, it's definitely all the millions poured into Erlang development and publicity that made it the COSA killer it is today.

      LOL. Yep. that's it. If COSA had the backing of a company like Ericsson (ask Joe Armstrong, he'll tell you), it would not only kill crappy Erlang, it would kill every other language else as well, being that they all suck. ahahaha...

    22. Re:The Seven Deadly Sins of Erlang by MOBE2001 · · Score: 0, Troll

      Have you used LabVIEW? If so, how is it similar/different to your COSA "ideal"?

      There are similarities but COSA takes parallelism and deterministic timing to an extreme. COSA is 100% reactive, that is, it is based on change.

    23. Re:The Seven Deadly Sins of Erlang by rk · · Score: 1

      Yes, that's right. I'm completely fanatical for a language I've never used. I'm rolling my eyes now... just in case the sarcasm went totally over your head.

      Why do I have to fork up the money? You're the one with the extraordinary claims of dramatic reliability increases. If you're so much more brilliant than the rest of us, it shouldn't be terribly difficult for you to at least create something a little more sophisticated than something that looks like an OmniGraffle demo on stupid pills in a few weekends. I just want to know: Will COSA let us reprogram the Time Cube?

      Before you replied, I wasn't sure if you were a complete crackpot. Thank you for resolving the question.

    24. Re:The Seven Deadly Sins of Erlang by Rakishi · · Score: 2, Funny

      Foaming at the mouth? No, you;re misunderstanding. we're either on the floor laughing at your stupidity or starting dumbfounded at our screens wondering how someone as stupid as you can possibly exist.

      Please do continue posting as it's endlessly amusing, people like you are like digital clowns. After all every society needs a town idiot to make everyone else feel better about themselves.

    25. Re:The Seven Deadly Sins of Erlang by rubycodez · · Score: 1

      that of course was just a juvenile joke. and I really don't like Erlang or my nick would be Erlangcodez. LISP of course is the language that can do anything and everything, but who wants to squint at that offal?

    26. Re:The Seven Deadly Sins of Erlang by abigor · · Score: 1

      I think it's worthwhile to point out you also say things like this:

      "Kurt Gödel (how could I forget him?) is one of the gods of the voodoo science pantheon. Gödel is certainly the most often quoted yet inconsequential mathematician of the world. He is known for his incompleteness theorem, the most non-scientific, chicken-feather-voodoo nonsense ever penned by a member of the human species. In 1949, Gödel announced to the world that Einstein's general theory of relativity allows time travel to the past via "closed time-like curves." The only thing Gödel proved, in my opinion, was the incompleteness of his frontal lobe."

      So your opinions are just so much loudmouthed nonsense.

    27. Re:The Seven Deadly Sins of Erlang by TheRaven64 · · Score: 1

      Did you know that Erlang cannot do fine-grain parallelism? That's right. There is no parallel quicksort algorithm in Erlang That's very interesting, considering that when I gave a talk on Erlang a year ago one of the examples I gave was parallel quicksort. It fitted nicely on a single slide at a size big enough for everyone in the room to be able to read.

      Oh, and in reply to your other comment about the amount of backing that Erlang had; the first version was written in Prolog in a week by two guys. It wasn't fast, but it was a good enough prototype to persuade people to invest in developing the full version. If you're looking for investment in your pet project, I suggest you do the same thing.

      --
      I am TheRaven on Soylent News
    28. Re:The Seven Deadly Sins of Erlang by Jack9 · · Score: 1

      You sir, have been trolled by the author. Congrats.

      --

      Often wrong but never in doubt.
      I am Jack9.
      Everyone knows me.
    29. Re:The Seven Deadly Sins of Erlang by Fujisawa+Sensei · · Score: 1

      Talk's cheap why don't you just upload an implementation your quaint little language to a server and show us your parallel quicksort algorithm.

      --
      If someone is passing you on the right, you are an asshole for driving in the wrong lane.
    30. Re:The Seven Deadly Sins of Erlang by MOBE2001 · · Score: 0, Troll

      Please do continue posting as it's endlessly amusing, people like you are like digital clowns. After all every society needs a town idiot to make everyone else feel better about themselves.

      ahahaha... That sure looks like foaming at the mouth and jumping up and down to me. ahahaha... Let's see. How many ways can Erlang be crappy? Let me count the ways. One, two, three, four, five, six, seven... ahahaha...

    31. Re:The Seven Deadly Sins of Erlang by Anonymous Coward · · Score: 0

      One, two, three, four, five, six, seven... ahahaha...

      The Count? Is that you?
    32. Re:The Seven Deadly Sins of Erlang by Anonymous Coward · · Score: 0

      You beat me to the Timecube reference - bastard!

    33. Re:The Seven Deadly Sins of Erlang by Rakishi · · Score: 1

      Why exactly do you expect me to care about Erlang, I've never even heard of it before today.

    34. Re:The Seven Deadly Sins of Erlang by OrangeTide · · Score: 1

      I love 6. It doesn't even make sense. Should we be using English or 6502 machine code for programming in the future?

      6. It is a computer language (based on English). Why English? Why not Mandarin, Swahili, Romansh or Latin for that matter? Programming a computer should have absolutely nothing to do with one's mother tongue. Written code is notoriously hard to understand, even when it is your own code. Only programming nerds are enamored with cryptic code. It's a badge of honor to them. Truth is, the very fact that programming has to rely on a specific natural language is a sure sign that something is wrong with the linguistic approach. Not to mention the nasty little fact that languages are inherently sequential, which makes them ill-suited to parallel programming.

      --
      “Common sense is not so common.” — Voltaire
    35. Re:The Seven Deadly Sins of Erlang by Anonymous Coward · · Score: 0

      You're not related to that Shelly the Republican, no?

    36. Re:The Seven Deadly Sins of Erlang by Eideewt · · Score: 2, Funny

      "COSA is 100% reactive, that is, it is based on change."

      Or would be if it... you know, existed.

      lol

      I'm sure you're taking the Internet crank world by storm. Best of luck to you.

    37. Re:The Seven Deadly Sins of Erlang by poopdeville · · Score: 1

      Dance for me, puppet. Tell me more about Erlang.

      The informed know more about Erlang than you do. They know your opinion doesn't matter. But they also know your opinion is entertaining.

      --
      After all, I am strangely colored.
    38. Re:The Seven Deadly Sins of Erlang by tchuladdiass · · Score: 1

      I followed his link in that bullet point to his page describing his concepts for avoiding "algorithmic programming" (what I think he means is imperative or sequential programming). What is described there (as circuit programming?) kind of looks like pipeline programming, where you have modules that take input and deliver output just like a Unix pipe, but instead of only one input and one output you get multiple inputs/outputs. This is actually looks like a Hartman Pipeline, combined with a standardized (structured?) message passing framework.

      Or, maybe I completely missed what he was saying, and that's the best interpretation I can come up with. My brain still hasn't kicked in yet.

    39. Re:The Seven Deadly Sins of Erlang by Anonymous Coward · · Score: 0

      ahahahaah hahahahaha hahahahahah ahhaahahahah ahahahahahah hahaahahh haahahahah ahahahaah ahahhahahaha ahahahahahah ahahhahah ahahahhaha ahahhahah ahahahah hahaha ahahah ahahaahah ahahahahahaahah ahhaahahhha ahahahahahah ahahahahahaha ahahahhahah hahahaahahhah ahahahahah ahahhaahah ahahahahah ahhahahha hahahahahahahahah hahahaha ahaahah hahah ahahaha aahahahah ahahahahahahaa aahahahahahahahahahahahahhaahhahahahahahahaaaa!!!

    40. Re:The Seven Deadly Sins of Erlang by rubycodez · · Score: 1

      slashdot exists for my amusement, I'm having fun sorry you aren't

    41. Re:The Seven Deadly Sins of Erlang by Jack9 · · Score: 1

      What makes you think that?

      --

      Often wrong but never in doubt.
      I am Jack9.
      Everyone knows me.
    42. Re:The Seven Deadly Sins of Erlang by chochos · · Score: 1

      Wow I've never seen that TimeCube thing before... been reading a while but it just doesn't make sense. Maybe it was translated from another language by the same translator that produced this?

      GIVE CONES CHANGE THE MACHINE!!!

    43. Re:The Seven Deadly Sins of Erlang by ralphbecket · · Score: 1

      That's the funniest thing I've read in ages.

      The author was joking, right?

  9. apropos erlang (Go Sweden!) by Jhan · · Score: 2, Informative

    The Ericsson Language, for those who have not been exposed to it, is a programming language meant to make concurrent (multi-process, multi-processor, multi-machine) programming really simple. It's used on many AXE telephone base stations world-wide. It has great message-passing support, and a pretty nice library. It is actually not a functional language, but a logical one. Basically a perverted version of Prolog.

    --

    I choose to remain celibate, like my father and his father before him.

    1. Re:apropos erlang (Go Sweden!) by MenTaLguY · · Score: 1

      Erlang is a functional language with prolog-style unification for pattern matching, just like one sees in ML or Haskell.

      --

      DNA just wants to be free...
    2. Re:apropos erlang (Go Sweden!) by poopdeville · · Score: 1

      The distinction between a functional and logic programming language is merely syntactical, due to the trivial characterization of functions in terms of truth functions (and truth functions in terms of functions).

      --
      After all, I am strangely colored.
    3. Re:apropos erlang (Go Sweden!) by bakuun · · Score: 1
      "It is actually not a functional language, but a logical one."

      Why not a functional language? I took an erlang course, and one of the speakers was one of the guys developing it at Ericsson. He specifically spoke of its qualities as a functional language.

    4. Re:apropos erlang (Go Sweden!) by Jhan · · Score: 1

      I regretted that almost as soon as I had posted it :-) Looks like Prolog != works like Prolog.

      --

      I choose to remain celibate, like my father and his father before him.

    5. Re:apropos erlang (Go Sweden!) by Jhan · · Score: 1
      ...trivial characterization of functions in terms of truth functions (and truth functions in terms of functions)

      First: I was completely wrong, Erlang is not a logical language. Prolog is.

      Second: Really? How about this example (Prolog pseudo-code, inc() and dec() increase/decrease a positive integer by one):

      add(X, 0, Sum) :- Sum = X.
      add(0, Y, Sum) :- Sum = Y.
      add(X, Y, Sum) :- dec(X, 1, X2), inc(Y, 1, Y2), add(X2, Y2, Sum).

      (at prompt)
      > add(2, 3, Sum)
      Sum = 5
      (as you say, trivially reproduceable in any functional language.)
      > add(X, 3, 5)
      X = 2
      (How do you "trivially" reproduce this in a functional language?)
      > add(X, Y, 2)
      X = 0, Y = 2
      X = 1, Y = 1
      X = 2, Y = 0
      (Likewise?)
      --

      I choose to remain celibate, like my father and his father before him.

    6. Re:apropos erlang (Go Sweden!) by MenTaLguY · · Score: 1

      The difference between functional and logic programming is that the former's model of evaluation is function application/beta-reduction, whereas the latter's is unification. It isn't just a syntactic distinction.

      --

      DNA just wants to be free...
    7. Re:apropos erlang (Go Sweden!) by TheRaven64 · · Score: 2, Informative

      add(X, 0, Sum) :- Sum = X.
      add(0, Y, Sum) :- Sum = Y.
      add(X, Y, Sum) :- dec(X, 1, X2), inc(Y, 1, Y2), add(X2, Y2, Sum).
      This is quite bad Prolog. Try this instead:

      add(0,X,X).
      add(s(X),Y,s(Sum)) :- add(X, Y, Sum).
      Where s/1 is a successor operator, which may or may not be defined, depending on how you wish to represent numbers. Your second case is not required, although it can be used for a tiny speed boost. If you want to take this to its logical conclusion, then you can assert/1 each result that you've already unified with true. This technique is more useful in something like a Fibonacci sequence, however.
      --
      I am TheRaven on Soylent News
    8. Re:apropos erlang (Go Sweden!) by poopdeville · · Score: 1

      In the context of truth functions, unification is function application. The difficulty is in showing that unification is sufficient to "trivially" emulate function application. In broad strokes, this is done by first noting that a function F can be written as a set of ordered pairs with the property that if (x, y) in F and (x, z) in F, then y = z. Thus suggests a truth functional definition of the function, which I will summarize by defining a class of propositions. We say f(x) = y iff (x,y) in F. Propositions of the form f(x) = y can trivially undergo unification.

      --
      After all, I am strangely colored.
    9. Re:apropos erlang (Go Sweden!) by nuzak · · Score: 2, Insightful

      Erlang does not stand for "Ericsson Language". It's named for the the telecom term, which itself was named for A. K. Erlang.

      And yeah it's like Prolog, except without horn clauses or backtracking. You know, just like lisp and java.

      --
      Done with slashdot, done with nerds, getting a life.
    10. Re:apropos erlang (Go Sweden!) by poopdeville · · Score: 1

      add(X, 0, Sum) :- Sum = X.
      add(0, Y, Sum) :- Sum = Y.
      add(X, Y, Sum) :- dec(X, 1, X2), inc(Y, 1, Y2), add(X2, Y2, Sum).

      (at prompt)
      > add(2, 3, Sum)
      Sum = 5
      (as you say, trivially reproduceable in any functional language.)
      > add(X, 3, 5)
      X = 2
      (How do you "trivially" reproduce this in a functional language?)
      > add(X, Y, 2)
      X = 0, Y = 2
      X = 1, Y = 1
      X = 2, Y = 0
      (Likewise?)


      You're going to shit bricks when you realize just how trivial the transformation is. It's already in a functional language. A truth functional language. A truth function is a function that takes a sentence to a truth value.

      The crux of the matter is that a function F can be defined to be a set of ordered pairs with the property that if (x,y) and (x,z) are in F, then y = z. In short, a function F is a model for the predicate f(x,y) (which is short for f(x) = y). Moreover, sentences of the form f(x) = y (one for each x in the domain) completely determine F.

      You used a similar construct in your example. As I'm sure you're aware, 'add(X,Y,Sum)' is a predicate meaning "X + Y = Sum". Also, the inc and dec "sentences" are short-hand for a class of sentences of the form "(X - n) + (Y + n) = Sum", where n is free in my description. Thus the addition function is completely determined.
      --
      After all, I am strangely colored.
    11. Re:apropos erlang (Go Sweden!) by MenTaLguY · · Score: 1

      Maybe I'm missing something, but all of the turing-complete approaches to computation are equivalent, and there are accordingly transformations between them. What makes this transformation more trivial than the others, that it renders the distinction between logic and functional programming less meaningful than the distinction between functional and any other approach?

      --

      DNA just wants to be free...
    12. Re:apropos erlang (Go Sweden!) by lastninja · · Score: 2, Interesting

      Actually it stands for both.

      --
      John Carmack fan, browsing at +5 since 1999.
    13. Re:apropos erlang (Go Sweden!) by poopdeville · · Score: 1

      Maybe I'm missing something, but all of the turing-complete approaches to computation are equivalent, and there are accordingly transformations between them. What makes this transformation more trivial than the others, that it renders the distinction between logic and functional programming less meaningful than the distinction between functional and any other approach?

      This is rather hard to answer. Obviously, my point wasn't about models of computation. It was about the equivalence of programming paradigms. For example, it turns out that continuations and objects are equivalent in this sense. You can implement objects using continuations. You can implement continuations using objects. Neither alone is Turing complete. So the Church-Turing thesis doesn't apply. In effect, objects and continuations are just different syntax for the same idea. This is unlike Turing machines and the Lambda calculus, which are conceptually very different -- functions are inherently stateless, whereas Turing machines change over time.

      Specifically addressing your question: the intimate relationship between functions and truth functions (a specific kind of function, and a necessary concept for the definition of functions). As I said, a function can easily generate a truth function. A truth function can even more trivially generate a function (since it's a function already).

      Now, note that because of this paradigmatic equivalence, functional and logical programming share properties that might have seemed surprising before. They're both side-effect free. Both, in principle, allow currying (despite being very non-obvious in the case of logical programming).

      --
      After all, I am strangely colored.
    14. Re:apropos erlang (Go Sweden!) by kubalaa · · Score: 1

      Did you mean "closures" and objects? Because I've never heard anybody compare continuations to objects (in the object-oriented sense).

      --

      "If you look 'round the table and can't tell who the sucker is, it's you." -- Quiz Show

    15. Re:apropos erlang (Go Sweden!) by poopdeville · · Score: 1

      Yes.

      --
      After all, I am strangely colored.
    16. Re:apropos erlang (Go Sweden!) by Hal_Porter · · Score: 3, Informative

      Ericsson is a Swedish company, founded by Lars Magnus Ericsson. Erlang was developed by Swedes at Ericsson but is named after Erlang who was unfortunately Danish. It is possible some Danes sneaked in and did this naming before the security guards could throw them out.

      --
      echo -e 'global _start\n _start:\n mov eax, 2\n int 80h\n jmp _start' > a.asm; nasm a.asm -f elf; ld a.o -o a;
    17. Re:apropos erlang (Go Sweden!) by captain_dope_pants · · Score: 0

      Eriksson is a Swedish person who was funded by The Football association. England was not very well developed by the turnip Eriksson and were unfortunately as useless as Darius Danesh.

      --
      while (true != false) process_more_stupid_code();
    18. Re:apropos erlang (Go Sweden!) by Anonymous Coward · · Score: 0
      You're going to shit bricks when you realize just how trivial the transformation is.

      To shit bricks is generally meant as an indication of fear. You'd think someone with a name like poopdeville would know these things.

    19. Re:apropos erlang (Go Sweden!) by psmears · · Score: 1

      You're going to shit bricks when you realize just how trivial the transformation is. It's already in a functional language. A truth functional language. A truth function is a function that takes a sentence to a truth value.

      That's just disingenuous. True, you could write the definitions of "add" from the Prolog program (with trivial adjustments for syntax) in Haskell, and it would define the same "add" function, in a purely mathematical sense. But it wouldn't be the same program.

      Sure, it would answer queries such as "is add(2,3,5) true"? But it would be quite useless for the queries that the GP posed, even the basic "what value of X satisfies add(2,3,X)?". Answering that sort of question, using the truth function as a base, would require applying the truth function to a (potentially infinite) sequence of values, and the selection and generation of that sequence is definitely nontrivial. So the claim that functional and logic programming languages are "trivially" equivalent is yet to be demonstrated :)

    20. Re:apropos erlang (Go Sweden!) by poopdeville · · Score: 1
      That's just disingenuous. True, you could write the definitions of "add" from the Prolog program (with trivial adjustments for syntax) in Haskell, and it would define the same "add" function, in a purely mathematical sense. But it wouldn't be the same program.

      The right word to use here is "correct", not "disingenuous." You evidently don't understand my point. The model for evaluation in a logical programming language is called "unification". From the Wikipedia article:

      In mathematical logic, in particular as applied to computer science, a unification of two terms is a join (in the lattice sense) with respect to a specialisation order. That is, we suppose a preorder on a set of terms, for which t* ? t means that t* is obtained from t by substituting some term(s) for one or more free variables in t. The unification u of s and t, if it exists, is a term that is a substitution instance of both s and t. If any common substitution instance of s and t is also an instance of u, u is called minimal unification.[1]
      A lattice of sentences is formed, and the image of the lattice under truth functions (the arrow, cup, cap, biconditional, negation) is considered.

      Guess how functional programming languages are evaluated. By unification! Only, instead of just considering truth functions (they are included), arbitrary functions are evaluated. Logical programming is, trivially, a specialized form of functional programming. One that deals with truth functions. The fact that logical programming languages use different algorithms to compute the join is a mere implementation detail and irrelevant to this point.

      The "hard" part is showing that every functional program has an equivalent logical program. Since these are all finite domains, a brute force approach is fine. Take a function F (as a set). For each element (x,y) in F, declare that f(x) = y is true using the logical language's syntax. Use short-hand syntax if you'd like. Q.E.D.
      --
      After all, I am strangely colored.
    21. Re:apropos erlang (Go Sweden!) by psmears · · Score: 1

      The right word to use here is "correct", not "disingenuous."

      No, your assertion is not correct. The programs are not the same, because they do not perform the same computation. Though the "add" relation that they define is the same, the functions that you can ask the language to evaluate are not the same. If I'm writing a program, I'm not just concerned about the fact that it contains a definition of a particular mathematical object—I need to know what it will tell me about that object, that is, what function of it will be evaluated. The fact that two programs calculate different functions and give different answers is not a trivial one :)

      The model for evaluation in a logical programming language is called "unification". Well done.

      Guess how functional programming languages are evaluated.

      By repeated beta reduction?

      By unification! Only in a technical sense. When it is said that logic programming languages use "unification", they are overloading the term to mean that they use a particular algorithm (the "unification" algorithm) that gives the most general unification, and they use this to search for all ways of satisfying a given relation. Functional languages only give at most one way a relation can be satisfied (which is, after all, what makes a relation a function!).

      Only, instead of just considering truth functions (they are included), arbitrary functions are evaluated. Logical programming is, trivially, a specialized form of functional programming. One that deals with truth functions. The fact that logical programming languages use different algorithms to compute the join is a mere implementation detail and irrelevant to this point.

      No, it isn't. It's relevant because it produces different results!

      The "hard" part is showing that every functional program has an equivalent logical program. Since these are all finite domains, a brute force approach is fine. Take a function F (as a set). For each element (x,y) in F, declare that f(x) = y is true using the logical language's syntax. Use short-hand syntax if you'd like. Q.E.D

      Nice try, but no! Finite domains? The domain of a function in a functional program can be infinite. Take the identity function: that should be pretty clear. Or a function that adds one to each element of a list of integers. There are an infinite number of such lists (take the list that contains n instances of the number 7, for any natural number n). So your proof falls down.

      And you haven't even proven the other half of the equivalence, that logic programs can be trivially rewritten as functional languages. Give some evidence for that: a program is equivalent to the function it computes, so given that the logic program given before computes all numbers x, y for which the relation "sum" holds for sum(x, y, 10), how would you transform the program to give that list of numbers in a functional language?
    22. Re:apropos erlang (Go Sweden!) by poopdeville · · Score: 1

      No, your assertion is not correct. The programs are not the same, because they do not perform the same computation.

      My programs perform isomorphic computations. Sure, using functional syntax I'll get a result like "f(x) = y". And using logical syntax, I'll get something along the lines of "|- f(x,y)". (Or if I just did it with the same interpreter, f(x,y) = #t. (Are you going to complain about the syntactic sleight of hand there too?)

      Only in a technical sense. When it is said that logic programming languages use "unification", they are overloading the term to mean that they use a particular algorithm (the "unification" algorithm) that gives the most general unification, and they use this to search for all ways of satisfying a given relation. Functional languages only give at most one way a relation can be satisfied (which is, after all, what makes a relation a function!).

      The technical sense is the only sense that matters in technical discussions. I'll take your explanation as a concession of the point. By the way, a unification, if it exists, is unique up to isomorophism.

      Nice try, but no! Finite domains? The domain of a function in a functional program can be infinite.

      If you know of a computer that can store arbitrary integers (let alone a set of arbitrary cardinality), I suggest you buy stock now. Functional programming is not the same as the lambda calculus, though they are obviously closely related. If we were talking about the lambda calculus.

      And you haven't even proven the other half of the equivalence, that logic programs can be trivially rewritten as functional languages. Give some evidence for that: a program is equivalent to the function it computes, so given that the logic program given before computes all numbers x, y for which the relation "sum" holds for sum(x, y, 10), how would you transform the program to give that list of numbers in a functional language?

      You're trolling, right? I have already done this, twice. The answer lies in the meaning of beta-reduction in the context of truth functions. (More succinctly, truth functions ARE FUNCTIONS). There's no need to "translate" the program, because application of truth functions is a specialized form of functional evaluation. The fact that logic programming languages use specialized unification algorithms is immaterial to this point. They are still computing the "substitution instance" join of the truth functional values of certain sentences.

      --
      After all, I am strangely colored.
    23. Re:apropos erlang (Go Sweden!) by psmears · · Score: 1

      My programs perform isomorphic computations. Sure, using functional syntax I'll get a result like "f(x) = y". And using logical syntax, I'll get something along the lines of "|- f(x,y)". (Or if I just did it with the same interpreter, f(x,y) = #t. (Are you going to complain about the syntactic sleight of hand there too?)

      I have no problem with the syntax, I have a problem with the results: the logic program (as Jhan pointed out) can answer the question "What pairs (X, Y) of numbers sum to 2", giving the answer {(0, 2), (1, 1), (2, 0)} (allowing flexibility for syntax, as you request ;-). The corresponding functional program can't do that—indeed it cannot return any values other than True or False. So the computations are certainly not isomorphic.

      The technical sense is the only sense that matters in technical discussions. I'll take your explanation as a concession of the point.

      You're perfectly free to take my comment any way you like. However, if you read carefully, you'll find that the "technical" sense in which unification is involved at all is one which doesn't actually support your argument.

      By the way, a unification, if it exists, is unique up to isomorophism.

      No. As you quoted to me from Wikipedia: "If any common substitution instance of s and t is also an instance of u, u is called minimal unification.". There can be many unifications of two terms, but at most one minimal unification. In lattice terms, a unification is an upper bound for the terms; the minimal unification is the (unique) least upper bound.

      If you know of a computer that can store arbitrary integers (let alone a set of arbitrary cardinality), I suggest you buy stock now.

      Who said anything about storing arbitrary integers? I merely suggested that a functional program can compute a function on values from an infinite domain. Granted, a particular computer only has finite memory. But unfortunately for your proof, the computer does not need to store an entire value in memory to calculate a function of it. Take the example I suggested, of adding one to every element of a list: the computer can read in one value of the list, add one to it, output that number, then repeat—using hardly any storage at all. What's more, with a lazy functional language such as Haskell, that is how the computation will actually proceed: values are read from the input as they are needed, and output as they are produced. For arbitrarily large values of n, you can input a list of length n (on the terminal, or via the network), and the (finite) computer will produce the result as it goes along. There are clearly an infinite number of such lists. As you said in a previous post, "QED".

      You're trolling, right? I have already done this, twice. The answer lies in the meaning of beta-reduction in the context of truth functions. (More succinctly, truth functions ARE FUNCTIONS). There's no need to "translate" the program, because application of truth functions is a specialized form of functional evaluation.

      You've successfully shown that there is an injection from the space of logic program syntax into the space of functional program syntax—but the injection is not program-preserving. The languages impose very different semantics, as discussed above—in the logic language you can get a list of results; in the functional one, you can't.

      The fact that logic programming languages use specialized unification algorithms is immaterial to this point. They are still computing the "substitution instance" join of the truth functional values of certain sentences.

      Rubbish. You can't compute a substitution instance join of a truth functional value, as it's defined on syntax, not functions.


      Thanks for the discussion. It's been entertaining :-)



  10. Possibly the greatest programming book I've read by ikewillis · · Score: 4, Insightful

    This book is written by the language's creator, Joe Armstrong, and provides one of the best introductions to a programming language I've ever seen. The entire approach is nicely bottom up, with the idiosyncrasies of the syntax presented immediately so they are not confusing later. More powerful features are introduced, such as the tools for concurrent and distributed programming, with the book finishing off with the immensely powerful Open Telcom Platform and its associated tools, such as the "one server to rule them all" gen_server implementation and Erlang's distributed database, Mnesia.

    All in all this is an excellent book about an excellent language and I would highly recommend it to any programmer, especially those concerned with the multicore future which will increasingly demand concurrent programming languages.

  11. Wings3D by UglyMike · · Score: 4, Informative

    Strange that I didn't see Wings3D mentioned yet. ( http://www.wings3d.com/ )
    It's an open-source subdivision surface modeler held to great esteem in the modeling scene

    It is also an Erlang application....

    1. Re:Wings3D by Anonymous Coward · · Score: 0

      Luckily Wings3d is relatively feature complete.

      Its development is pretty slow because there are very few developers who know Erlang.

      Hopefully a few /.ers will read this book, and need a pet project to want to throws their skills at and Wings3D will get a developmental shot in the arm.

    2. Re:Wings3D by Anonymous Coward · · Score: 0

      Agreed. Wings3D is my favorite modeler -- extremely easy-to-use, productive, and stable. But for me Erlang is a barrier to contribution. I'm glad others have had the time and motivation to pick up the language and contribute, though. Maybe I'll have to take a look through this book...

    3. Re:Wings3D by TheRaven64 · · Score: 2, Interesting

      What about eJabberd? It's currently the most feature-complete open source Jabber server, and it's written in Erlang. I've just migrated from Jabberd (written in C, and older) to eJabberd for the features.

      --
      I am TheRaven on Soylent News
    4. Re:Wings3D by Anonymous Coward · · Score: 0

      Ditto about the lack of Erlang devs. Not much of a programmer myself (occasional web/flash scripting doesn't count, does it?) but Wings could always use some more devs. Despite the community and great support, I think I can still count the number of project devs for it on my fingers.

      Also I suspect at least two of the devs for Wings are actually involved in the development of Erlang itself. (Same names on roster at Ericsson, etc.) But they never seem to fully 'fess up to it.

      Now those who are up to 3D programming and a challenge - give Erlang a shot. I need mah plug-insssss!

  12. Review worth a +1 karma! by Z00L00K · · Score: 5, Informative
    The review is well written, and even though Erlang is a programming language that not everyone is used to program in it's well worth to mention that a large number of telecommunication devices from Ericsson are running software written in Erlang, so most people has probably been using it without knowing it.

    And in my opinion; If you are familiar with more common languages like C and Java you should take a deeper look into Erlang unless you prefer to study Prolog or Cobol. Just take a dip or a deep plunge, you never know when you end up in a project where knowing Erlang may prove useful - it is actually developed to be used in real applications and not as a theoretical study object.

    And Erlang is designed to handle concurrent programming from the bottom, which is a real problem in large multi-user systems. You can of course use C or Java and solve concurrency problems with semaphores or synchronization, but the solution in Erlang may be much more elegant.

    And for all of you that are familiar with the Eclipse development environment; There is a plugin called Erlide.

    --
    If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
    1. Re:Review worth a +1 karma! by Jugalator · · Score: 1

      it's well worth to mention that a large number of telecommunication devices from Ericsson are running software written in Erlang Something more interesting to me would be use outside of Ericsson. Erlang is after all short of Ericsson Language, so what you say is not surprising. However, does this imply it's wide spread in e.g. telecommunications outside of Ericsson? Any other common, modern, use besides for the occasional pet project?
      --
      Beware: In C++, your friends can see your privates!
    2. Re:Review worth a +1 karma! by Anonymous Coward · · Score: 0

      On FLOSS side, see ejabberd and Wings 3D.

      There's also a list of commercial uses.

    3. Re:Review worth a +1 karma! by Inthewire · · Score: 1

      Or, maybe, the Erlang FAQ has a better answer:

      10.1. Why is Erlang called "Erlang"?

      Erlang is named after the mathematician Agner Erlang. Among other things, he worked on queueing theory. The original implementors also tend to avoid denying that Erlang sounds a little like "ERicsson LANGuage".

      --


      Writers imply. Readers infer.
  13. Darn firehose by zeromorph · · Score: 0, Offtopic

    Me, too.

    ...usually a glitch in the google grid. It happens when they change something.

    --
    "Hannibal's plans never work right. They just work." Amy/A-Team
  14. I know why it's been 10 years by lib3rtarian · · Score: 1
    I just looked up Functional Programming in Wikipedia. Wow, I thought assembly was bad. Albeit, I didn't spend more than fifteen minutes on it, but, after reading this review, and looking at some examples, I'm totally confused.
    I pulled this example from Wikipedia:

    # imperative style
    target = [] # create empty list
    for item in source_list: # iterate over each thing in source
    trans1 = G(item) # transform the item with the G() function
    trans2 = F(trans1) # second transform with the F() function
    target.append(trans2) # add transformed item to target

    A functional version has a different feel to it:

    # functional style
    # FP-oriented languages often have standard compose()
    compose2 = lambda F, G: lambda x: (F(G(x))
    target = map(compose2(F,G), source_list)

    The first block of code is easy to understand. The second block, whoah, I guess I just have to take your word that it does the same thing as the first block. Can someone give me an introduction/explanation to Erlang / functional programming that I can understand? At this point, I don't even understand what situations this could be usefully applied to.
    It seems interesting though...
    1. Re:I know why it's been 10 years by stormcoder · · Score: 1

      Wow you must be new here. Expecting the /. community to do something constructive like teaching programming...

      map is a higher order function that takes a list and iterates over the elements calling a function, that is also passed in, on each element. The results are returned from map as another list. lambda creates anonymous functions. So an anonymous function is created and passed into map along with a list. It's a common functional idiom. Functional programming style is well worth knowing.

      --
      Sorry my bullshit sensor overloaded.
    2. Re:I know why it's been 10 years by Anonymous Coward · · Score: 0
      Very informal explanation here, but anyway.

      compose2 is declared as a function that given some value X, returns F(G(x)). That is, first runs G(x) and then runs its return value through Y. To make it more general, compose2 is further "initialized" with the two functions that are going to be used (think function pointers).

      So in pseudo C-style (sorry, don't remember the correct syntax):

      void * compose2(&F, &G, void *x) {
            return F(G(x));
      }


      Later, the "magic" map-function, which given a function and a list, runs that function on every item in the list and inserts the items into a new list.

      Simple, short, elegant.
    3. Re:I know why it's been 10 years by AuMatar · · Score: 0

      Also next to impossible to maintain, debug, or understand. You can look at the first function and understand it piece by piece almost instantly. You can easily run through it in a debugger, log it, and change it at a later date. The second requires deep though to understand, can't be easily debugged (unless you want to dive into a predefined function), can't be changed easily. So its short, but it is NOT simple or elegant. I'd call version one far more simple and more elegant.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    4. Re:I know why it's been 10 years by BitGeek · · Score: 1


      IF you consider yourself a serious programmer, you would do well to go download the free chapters of this book from the pragmatic programmers site and read up a bit.

      I too had an advers reaction after 20 years of OO programming.... but I stuck with it and now I see the light.

      Its worth the effort.

      --
      Yeah, and you guys panned the ipod too: http://apple.slashdot.org/article.pl?sid=01/10/23/ 1816257
    5. Re:I know why it's been 10 years by J.R.+Random · · Score: 4, Insightful

      There is nothing in the second example that isn't completely familiar to anyone who has ever programmed in LISP, one the world's oldest programming languages.

      Newbies, feh!

    6. Re:I know why it's been 10 years by curri · · Score: 1

      You probably want to check Wikipedia or something like that for the intro :) Many functional languages are relatively similar, so you may want to go with Haskel or even scheme (although scheme has completely different syntax).

      The functional block is about as easy to understand, once you know FP :), the first one is easier for you because it looks closer to what you know.

      So, let me try to explain:
      compose2 = lambda F, G: lambda x: (F(G(x))

      This makes compose2 denote a new function (lambda creates new functions), this function takes two arguments, F and G (which are functions by the way !) and returns a new function. This new function takes one argument, x and returns the result of applying F to G(x)

      This is actually incredibly nifty, since it lets you compose ANY functions of one argument! Compare that with function pointers in C or all the extra stuff we add in OO (say to add an event handler).

      Now, second line; map is a function that takes two arguments, a list and another function, and returns a new list containing the result of applying that other function to all elements of the original list.

      So
      target = map(compose2(F,G), source_list)

      means make target denote the result of applying the composition of F and G to all elements in the source_list. Isn't that beautiful ?

      Actually, this is really nifty but may be hard to get the first time (or the first ten :), OTOH, procedural programming is also hard at first :) if you actually have time, google for 'the little haskeller' or 'Structure and Interpretation of Computer Programs (for scheme)

    7. Re:I know why it's been 10 years by poopdeville · · Score: 1

      If you know perl, you can learn functional programming in about a day. You can learn the concepts involved in about an hour. See http://perl.plover.com/lambda/.

      As far as your example goes, note that if you allow yourself mathematical syntax, since trans1 = G(item), F(trans1) = F ( G(item) ). Indeed, since F and G are functions, we can create a new function (F o G) given by the rule (F o G)(x) = F( G(x) ). This is called functional composition. Lambda is a function constructor, as it is in the lambda calculus.

      The functional program says:

      1. create a function called 'compose2' which takes two arbitrary functions (which for the purposes of the definition will be called F and G) as arguments. Define compose2 as F ( G ( x) ).

      2. Let "target" be the result of applying (F o G)(x) (as described above) to each element in a list called source_list. (The semantics of map mean that target is a list such that target[i] = (F o G)(source_list[i])

      Way simpler, once you get it.

      --
      After all, I am strangely colored.
    8. Re:I know why it's been 10 years by k8to · · Score: 1

      To rephrase your observation: "Hey, I've been programming in imperative languages for decades, and this functional stuff is not familiar!"

      That's right, it's not easy for you to understand because you do not have experience with it. That doesn't mean it's somehow intrinsically more difficult to understand.

      --
      -josh
    9. Re:I know why it's been 10 years by MenTaLguY · · Score: 1

      The second one doesn't require particularly deep thought to understand, but it does require a very different way of thinking about code.

      --

      DNA just wants to be free...
    10. Re:I know why it's been 10 years by be-fan · · Score: 2, Informative

      So, think, what are you actually trying to accomplish in the first block of code, in terms of the end-result.

      You're computing a list, target, where each item is computed by F(G(x)), where x is an item from source_list, taken in order.

      Note that stuff like "iterating over source_list", and "appending to target" are not really important. They are certain necessary steps in one possible implementation of what you're trying to accomplish, but they're just incidental --- they're not part of the end result.

      Now, map is a function that takes two arguments: a function that takes one parameter and a list. It constructs a new list equal in length to the source list, with each element obtained by calling the function on one element of the source list. Ie: if you do map(square_number, [1, 2, 3]) you get [1 4 9].

      Now, let's look at the functional code. The first line is a function definition for the function compose2.

      compose2 = lambda F, G: lambda x: (F(G(x))

      lambda is a way of introducing a literal function, much like "1" is a literal integer. lambda F, G: ... means a function that takes two parameters, F and G, and returns ... (note the return is implicit. In this case, the compose2 variable is assigned to a lambda that takes two functions F and G, and returns a third function that takes a value x and computes F(G(x)). Note that this is exactly the function we want to use to compute our list.

      Now let's look at the second line:

      target = map(compose2(F,G), source_list)

      The code first calls compose2 with parameters F and G to get a function that computes F(G(x)). Note that this function is exactly in the form expected by map. Then it calls map with that function, and the source list. Map will internally apply F(G(x)) to each x in source_list, and retrn a list containing the results.

      Note that usually stuff like compose2 will be a standard library function, because this sort of thing is so common. In that case, your original five lines of code, becomes a single line, that expresses exactly the end result you want, without being cluttered with incidental details like iterating over or appending to a list.

      I should point out that I don't know Erlang, or whatever language that snippet is in. The second example is nonetheless easy for someone used to functional programs to understand, much like the first example is easy for an imperative programmer to understand, even one that doesn't know Python.

      --
      A deep unwavering belief is a sure sign you're missing something...
    11. Re:I know why it's been 10 years by Just+Some+Guy · · Score: 2, Informative

      At this point, I don't even understand what situations this could be usefully applied to.

      Well, functional programs have a lot of other restrictions, but it boils down to this: with very rare exceptions (such as file or socket handling), functions don't have side effects. That is, they don't modify a program's global state, and they don't depend on global state. You can call foo(args) 100 times in a row and each time the output will be identical. My C++ is rusty, but imagine something like:

      int foo(int &bar, int &baz) { return bar++ * baz++; }

      Any code that calls foo() will find its internal state changed - both bar and baz have been altered. In comparison, this is almost impossible to do accidentally in functional languages.

      So, great, what does that buy you? Well, the map() function in you example knows that it's supposed to call compose2() on each item in source_list. Because it's impossible for compose2() to have strange global side effects and it doesn't depend on external state, map() is free to fork() 10 times and let each child process munch through independent subsets of source_list. In the case of Erlang, map() is also free to hand off chunks of source_list to other machines and coalesce the results from all of those hosts at the end. As long as compose2() gets called on each item at some point, the order (and indeed the physical location) of each call doesn't matter a lick.

      Imagine that you have 20 quad-core systems in a cluster. Replacing the imperative example above with the functional example gives your code an 80x performance boost, minus a little network overhead. Does that sound more interesting now?

      --
      Dewey, what part of this looks like authorities should be involved?
    12. Re:I know why it's been 10 years by ForumTroll · · Score: 2, Insightful

      I agree partly with your sentiments on debugging - although I don't think it would be a huge problem. However, I don't think that the second piece of code is more difficult to understand than the first. I'm able to look at the second piece of code and easily understand exactly what's happening almost instantly. It largely depends on what you're used to. If you're used to writing only in an imperative style, obviously a functional style is going to take some time getting used to. The vice versa is also true. This doesn't mean that one is inherently superior to the other.

      --
      "A Lisp programmer knows the value of everything, but the cost of nothing." - Alan Perlis
    13. Re:I know why it's been 10 years by be-fan · · Score: 4, Insightful

      Also next to impossible to maintain, debug, or understand.

      Uh, if you don't know functional programming, then yeah. If you do, it's instant to understand, and can be maintained more easily because there is less of it to maintain.

      Your argument basically amounts to "stuff I don't know is hard to understand". No shit. New notation and concepts have to be learned, yes, but there is a point to learning them. It makes things simpler and easier once you have learned them. Consider, why do people in signal processing do all sorts of Z transforms and Fourier transforms and whatnot on data? Surely it's _easier_ to just think of a sound signal as a series of amplitudes at discrete time intervals? The thing is --- it isn't. Once you learn all that math, you can do stuff with signals by hand that you couldn't even have dreamed off if you'd used a less powerful technique.

      --
      A deep unwavering belief is a sure sign you're missing something...
    14. Re:I know why it's been 10 years by be-fan · · Score: 2, Insightful

      I agree partly with your sentiments on debugging - although I don't think it would be a huge problem.

      It's not a problem, because no functional programming language has a buggy map. There is no need to debug into map, it's a primitive like floating-point addition (which actually abstracts a much more complex algorithm than map!)

      --
      A deep unwavering belief is a sure sign you're missing something...
    15. Re:I know why it's been 10 years by Edward+Kmett · · Score: 2, Interesting

      The Haskell equivalent of the same thing would be:

      target = map (f . g) source_list

      A minor shift in syntax, and dropping a lot of superfluous parentheses from the language and adding sugar (.) for function composition goes a long way to cleaning that up into something readable. =)

      The main strengths of functional programming come when you start thinking about functions as first class values.

      Here the function obtained by composing f and g became a new function that was usable just like the primitives you built it up from. To do the same in say c++, c#, c, java, etc. you'd have to fall back on building up a struct or class and overloading method invocation on that class to get a function-like thing representing the idea of "do this, then do that to the result".

      Javascript gets the concept of closures right but the syntax for their functions is very verbose:

      function compose2(f,g) { return function(x) { return f(g(x)); } }

      vs.

      compose2 f g x = f (g x)

      --
      Sanity is a sandbox. I prefer the swings.
    16. Re:I know why it's been 10 years by MenTaLguY · · Score: 1

      Egh, part of the problem is that the functional programming example is pretty crappy, and they're both done in Python, which does not lend itself to readable functional programs. If the language doesn't already provide function composition, it's more sensible to write it out in a case like this. Showing the evolution between the two might also have been helpful.

      Reformulating in Ruby (a more neutral language), we get:

          result = []
          for item in source
              temp = g(item)
              temp2 = f(temp)
              result << temp2
          end

      Which is like (lambda declares a function in-place, and 'each' applies a function to each element in a collection in turn):

          result = []
          source.each(&lambda { |item|
              temp = g(item)
              temp2 = f(temp)
              result << temp2
          })

      Which, in Ruby, can be more concisely written:

          result = []
          source.each { |item|
              temp = g(item)
              temp2 = f(temp)
              result << temp2
          }

      Which can be condensed to:

          result = []
          source.each { |item| result << f(g(item)) }

      Which you don't need to write out because it turns out there's already a standard functional way to do this, where the collection-building is handled internally:

          result = source.map { |item| f(g(item)) }

      At this point we need to switch languages to get more "functional" without verbosity, so I'll rewrite that in Haskell:

          result = map (\item -> f(g(item))) source

      Now, that anonymous function we've been using is no longer necessary, because there is a way to directly combine f and g into a single function that has the effect of both (the . operator is the equivalent of the grotty compose2 in the python example):

          result = map (f . g) source

      So, we get a very concise translation of "The result is the source list with g and f applied to each element". We know what map does (build one list from another by applying a function to each element), and we know what . does (combines two functions). Much less boilerplate, and much less to debug or mistype. Compared to imperative programming, you can more often build simple solutions out of well-tested library routines, rather than rewriting essentially the same list-building loop for the thousandth time and having to check/debug it each time.

      Now, I won't lie to you: functional programs are only concise like this if you can find the right abstraction to use, which is harder for some problems than for others, and requires a different set of skills than imperative programming. However, I know firsthand that developing those skills can be very rewarding and will improve the quality and concision of one's programming in any paradigm.

      --

      DNA just wants to be free...
    17. Re:I know why it's been 10 years by Anonymous Coward · · Score: 0
      So what is Ruby? I've never found functional programming to make any sort of sense; at least not those languages which claim explicitly to be functional. The same code in Ruby, though, looks like:

      target = source.map { |x| F(G(x)) }
      Simple, clean, I understand it. Is this functional? Ruby could easily mimic the imperative style as well, though.
    18. Re:I know why it's been 10 years by Anonymous Coward · · Score: 0

      I showed this to a friend of mine who graduated in chemical engineering and thus had only a basic understanding of programming (some Matlab, some basic C etc) and immediately recognized the power and elegance of functional programming.

    19. Re:I know why it's been 10 years by TheRaven64 · · Score: 1

      Actually, the reverse is true. Functional programming is programming without side effects, which means that it maps cleanly to mathematics and so reasoning about it is easy. This is why languages like Haskell are popular in the formal verification community; it's much easier to prove that a functional program does what you think it does than an imperative program. That said, the syntax of the Wikipedia example is not great, as an example. Unless you understand Lambda Calculus, you will find reading that kind of thing hard (which is why Lambda Calculus is taught in most CompSci degrees fairly early on).

      --
      I am TheRaven on Soylent News
    20. Re:I know why it's been 10 years by DavidHumus · · Score: 1

      A better illustration might perform something other than scalar operations on the items, but here is a specific example of what this means using the functional language J http://www.jsoftware.com/; lines prefixed by spaces are user input, un-prefixed lines are the interpreter's response; comments begin with "NB." and go to the end of the line.

            NB. First, define G and F:
            G=: 1&+ NB. Add 1
            F=: *: NB. Square
            NB. How each one works separately:
            G 1 2 3
      2 3 4
            F 2 3 4
      4 9 16
            NB. How they work together:
            F G 1 2 3
      4 9 16
            NB. Working together using explicit composition:
            F@G 1 2 3
      4 9 16

    21. Re:I know why it's been 10 years by MenTaLguY · · Score: 1

      Argh, I misplaced the parenthesis in the Haskell version. Should have been:

          result = map (\item -> f (g item)) source

      Or, more idiomatically:

          result = map (\item -> f $ g item) source

      --

      DNA just wants to be free...
    22. Re:I know why it's been 10 years by Algan · · Score: 2, Informative

      Actually FP code is an order of magnitude easier to debug/maintain/understand, once you get past the weird syntax and restrictions. The absence of side effects makes it easier to isolate a problem or to build up an understanding of what the code does. The human brain can focus on only so many things at once. Since you don't have side effects, a function's result depends only on its parameters, so once you understand it you can think of it as a black box and move up to the call chain. When you debug, you can move up and down the stack until you figure out what function returns a wrong result and then you know that the problem is isolated to that function (there are no global variables/outside environment that can affect that function)

      --
      If con is the opposite of pro, is Congress the opposite of progress?
    23. Re:I know why it's been 10 years by Taagehornet · · Score: 1

      Can someone give me an introduction/explanation to ... functional programming that I can understand?
      Yes, Robert Harper's book Programming in Standard ML is available for download. It's a nice and thorough introduction to functional programming. It was an absolute joy to read.
    24. Re:I know why it's been 10 years by maxwell+demon · · Score: 1

      The functional block is about as easy to understand, once you know FP :)

      I disagree: The functional code is easier to understand.
      And no, I'm not a die-hard functional programmer; most of the code I've written is imperative.
      --
      The Tao of math: The numbers you can count are not the real numbers.
    25. Re:I know why it's been 10 years by Anonymous Coward · · Score: 0

      you should check out the "structure and interpretation of computer programs"
      by abelson & sussman

      http://mitpress.mit.edu/sicp/ : the book in html
      http://swiss.csail.mit.edu/classes/6.001/abelson-s ussman-lectures/ : video of lectures

      these are the folks that invented scheme, a powerful lisp variant that can
      be used for functional programming

      very cool stuff, if a bit mind-blowing at first.

      to be a bit stodgy and academic, lisp/scheme are
      fundamentally based on a different *model of computing* than most languages
      - the lambda calculus instead of turing machines -
      so it takes alot to wrap the head around..

      Watch the video lectures, drink some tea and chill out over the course of a few
      months, return to it again. rome was not built in a day, etc. you wont regret it.

    26. Re:I know why it's been 10 years by DragonWriter · · Score: 1

      The second block, whoah, I guess I just have to take your word that it does the same thing as the first block.


      The second block of code:

      1. Defines "compose2" as a function which takes as its parameters two functions F and G, and returns a function which takes an argument x and returns F(G(x)).

      2. Then defines "target" as the result of applying compose2 to two existing functions (F and G), and then applying the resulting function to each member of source_list.

      Its a bit confusing as an example because F, G are used as parameter names in the first line, and are also the names of the arguments passed to compose2 in the second line. While you might occasionally end up doing that, and there is usually nothign syntactically wrong with it in an FP language, its pretty confusing in an example.

    27. Re:I know why it's been 10 years by AuMatar · · Score: 1

      Mapping to mathematics doesn't mean its easy. Mathematical languages have been around for decades, in fact they were among the first. They aren't used because they *aren't* easy- very very few problems are easily described in mathematics. Thats why other languages like C++ exist- because math isn't fit for most programing problems, and because side effects are useful ways to get things done. Side effects are damn useful things- programming would be almost impossible without them. Even functional languages invoke side effects, as much as they wish they didn't- ever write to a file? Thats a side effect, and causes multiple side effects at the OS layer (incrementing file pointers, additions of items to queues, changes in scheduler structures, etc).

      --
      I still have more fans than freaks. WTF is wrong with you people?
    28. Re:I know why it's been 10 years by Clueless+Moron · · Score: 1
      Blech. The given example is the painful way to do it. The normal way to compose two functions and map them over a list in Python is a one-liner, like this:

      [f(g(x)) for x in source_list]
      This is called "list comprehension".
    29. Re:I know why it's been 10 years by Estanislao+Mart�nez · · Score: 1

      The second requires deep though to understand, can't be easily debugged (unless you want to dive into a predefined function), can't be changed easily.

      The example you're responding to is crummy, which is what leads you to think like this. Every language that supports functional programming in a decent way allows you to write and debug functions like map trivially. A simple implementation of map is trivial to understand too; it takes a list and a function, it creates a new list of the same length as the input list, and it fills it up with the result of calling the supplied function with the corresponding element of the input list. As long as your language allows you to pass functions as arguments to other functions in a straighforward manner (which C does not), there's no magic involved.

    30. Re:I know why it's been 10 years by Anonymous Coward · · Score: 0

      I think I still prefer list comprehensions (python example):

      target_list = [F(G(x)) for x in source_list]

    31. Re:I know why it's been 10 years by Trinn · · Score: 1

      As far as I can tell, they're both python, but I could be wrong. Oh yeah, and apparently I type too fast.

    32. Re:I know why it's been 10 years by be-fan · · Score: 1

      List-comprehensions are literally just syntax-suger for map:

      target_list = map(lambda x: F(G(x)), source_list)

      The braces are the call to map, the bit before the "for" is the body of the lambda, the bit after the "for" and before the "in" is the argument list of the lambda, and the bit after the "in" is the second parameter of the map.

      --
      A deep unwavering belief is a sure sign you're missing something...
    33. Re:I know why it's been 10 years by Anonymous Coward · · Score: 0

      The second block should even be understandable for someone with solid Python bases, or even just maths!

  15. Re:Possibly the greatest programming book I've rea by BrewerDude · · Score: 3, Interesting

    My vote for best introduction-to-programming book goes to Structure and Interpretation of Computer Programs (a.k.a. The Wizard Book) by Hal Abelson, Jerry Sussman, and Julie Sussman.

  16. Huh? by homer_s · · Score: 1

    Saying that the Author does a good job of leading you through the languages intricacies with examples being compared to code from languages such as Java to help keep your feet on solid programming ground.

    1. Re:Huh? by moderatorrater · · Score: 1

      Saying that, the Author does a good job of leading you through the languages intricacies with examples being compared to code from languages such as Java to help keep your feet on solid programming ground. The author seems to have missed a comma.
    2. Re:Huh? by homer_s · · Score: 1

      God - I read that about 10 times before posting and I never thought that a comma was the problem. I kept reading it as "Saying that the Author does a good job of leading you through the languages intricacies, ...... "

      Still, he could've written "Having said that, the author does a ..."

    3. Re:Huh? by mikehoskins · · Score: 1

      ...comma, miswording, dependent clause, or something else...

      I read that a few times, too.

      It kinda sounds like that girl from South Carolina, only vastly more intelligent... ;-)

  17. Any .Net Versions? by Crazy+Taco · · Score: 1

    And for all of you that are familiar with the Eclipse development environment; There is a plugin called Erlide.

    That's cool. Are there any .Net versions of the language? In fact, is that even possible given that Erlang is developed to be parallel from the bottom up, as opposed to other .Net languages?

    --
    Beware of bugs in the above code; I have only proved it correct, not tried it.
  18. Glad to see Erlang finally getting some attention by Cultural+Sublimation · · Score: 1

    I had my first encounter with Erlang at a Ericsson presentation back in 1994. It's amazing that more than ten years have passed since then, and only now is the language becoming more mainstream! This new-found attention is well-deserved, however: Erlang will feel right at home in those +80 CPU cores on the horizon...

    As for other less conventional languages, OCaml also definitely deserves a look. It is functional, though also allows imperative features; it has a powerful module system, but also supports object-oriented programming; it has a certain academic feel, but real-world performance (check the shootout if you want: it's among the fastest ones, comparable to C++) and a very good and comprehensive repository of libraries (even for low-level stuff!). Definitely one of the best things to come out of France in recent memory!

  19. Erlang... by tomq123 · · Score: 1

    the new programming language du jour.

  20. I bought the book early in PDF form by MarkWatson · · Score: 1

    Overall, the book is very good: the examples are clear and useful, and for an old Prolog programmer like me, Erlang has a natural feel to it.

    I have been disappointed that none of my customers seem to be interested in Erlang development - I proposed using it for one application where 'share nothing' asynchronous communication seemed like a very good fit.

  21. Be careful by roman_mir · · Score: 0, Troll

    If you program in Erlang you will look like these guys. (Oh, and I think these people actually believe that it is a good idea to allow modification of code directly in production environment. I think a library can be written explaining why this is a dumb idea.)

    1. Re:Be careful by BitGeek · · Score: 1


      Its surely a dumb idea for applications written in languages like C and Java... but not for erlang.

      Remember, systems running this language have had uptime on the order of many years, and that's with in-place code modification.

      You're rejecting what you don't understand based on assumptions that are true for other contexts.

      Downtime is a sin, not a virtue!

      --
      Yeah, and you guys panned the ipod too: http://apple.slashdot.org/article.pl?sid=01/10/23/ 1816257
    2. Re:Be careful by Chirs · · Score: 1

      You wouldn't *test* the modified code in the production environment, you do that in the lab. But it can definately be useful to modify apps on the fly without taking down the system.

      In fact, the company that I work for has done exactly this for C/C++ apps on four different hardware architectures. (There are restrictions....its basically impossible to modify an inline function, for instance.)

    3. Re:Be careful by roman_mir · · Score: 1

      Regardless of what the virtues of the language at hand, it is never a good idea to modify code directly in production without running a full suit of tests against the code. Businesses that rely on software applications running their systems must have well defined deployment processes. Code that goes into production must be tested against the specified requirements. While Erland (just like Javascript for example) supports dynamic typing, and while it allows (just like Javascript) updating functional code on the fly, it is still a terrible idea to allow developers to work on production systems directly without deploying code into testing and staging environments first. I'll just stop there.

    4. Re:Be careful by roman_mir · · Score: 1

      You are talking about a partial deployment, this can be specified as one possible deployment process to update production, and it is still a bad idea because at this point it is not possible to say for sure that what is running in production was built from a specific source controlling system's tag for example.

      So while it may work for some special cases, I am saying it is just a bad idea to do deployments like this as a principle, you can't be sure what is running in production at some point.

    5. Re:Be careful by k8to · · Score: 1

      Your criticism is completely irrelevant to the language feature. That the language (and runtime) allow for live updates does not mean that enforces (or encourages) live *edits*!

      --
      -josh
    6. Re:Be careful by roman_mir · · Score: 1

      It is not irrelevant from my point of view, because I have seen people pushing this language forward on this particular merit, that the deployment can be done without a real deployment by modifying code in production on the fly. Since that (and the dynamic typing) was the main reason why I have seen people try and push the use of this language forward, I don't think it's irrelevant.

    7. Re:Be careful by Anonymous Coward · · Score: 1, Insightful

      > So while it may work for some special cases, I am
      > saying it is just a bad idea to do deployments like
      > this as a principle, you can't be sure what is running
      > in production at some point.

      Decision Point:

      Choose from these options:

      1. Side with a Slashdotter who refuses to accept that
            this isn't testing-in-production;

      2. Trust telecoms companies who do this with Erlang
            FOR REAL with MILLIONS OF DOLLARS on the line,
            literally.

      Well shucks I don't know....

    8. Re:Be careful by roman_mir · · Score: 1

      3. Read carefully what the /.er wrote about special cases. In most cases this mode of deployment is unacceptable, like in most places I've worked as, which include telcos, utilities, banks, mutual funds, manufacturing and such.

      4. Profit from selling Erland as another silver bullet that will save the day.

    9. Re:Be careful by pintpusher · · Score: 1

      If you program in Erlang you will look like these guys. wow. substitute some absurdity about spam shortages and you've got a perfect python skit. amazing. thanks for the informative laugh.
      --
      man, I feel like mold.
    10. Re:Be careful by be-fan · · Score: 2, Informative

      Nobody live-updates a running Erlang (or Lisp, which does the same thing), without deploying the code into a test environment first. The thing that live-update let's you do is take a well-tested and well-debugged piece of code and inject it into a running service without stopping the service.

      AT&T uses Lisp for some of their call routing equipment for the same reason. If you need to add a new feature to a switch, you cannot drop the call's it's handling to swap out the software.

      There are also lot's of uses of live-updating in non-productive environments. For example, it can be used as a development model, drastically reducing the edit/compile/debug cycle. When I write Lisp code (I presume Erlang programmers would be similar here), I rarely restart the program I'm debugging to recompile it. For example, my current Lisp image has an uptime of about 2 days. That means for the last two days, I've been incrementally compiling and testing my changes into the same running process.

      It's also very helpful when the test scenario for the software is complicated. I maintain some software that does data collection/analysis of spectrum traces. Testing the software involves hooking up an antenna to a big awkward machine and going outside. The program is unfortunately written in C, which means I waste a lot of time shuttling back and forth between the test environment and the compiler. If I could stop the trace in the middle, make small changes, and keep going, my testing time would go way down.

      --
      A deep unwavering belief is a sure sign you're missing something...
    11. Re:Be careful by roman_mir · · Score: 1

      I am not arguing that some environments accepted this mode of deployment, I am insistant that in most cases this is counter-productive. One of the reasons is that you cannot know for sure what is running on production. Let's just hope that the author of every change that goes to production spent time adding the change to the source control system of the code and that the code is tested before it is injected into production. However beeing a contractor who is constantly asked to work on projects that have misplaced documentation and sometimes evens source code, I would hate beeing responsible for ensuring that what is in production is the same thing that is found in the source.

    12. Re:Be careful by Chandon+Seldon · · Score: 1

      Obviously you "modify on the fly" your test server first, and then once you've tested it (as usual), you "modify on the fly" your production server. I fail to see the problem here.

      --
      -- The act of censorship is always worse than whatever is being censored. Always.
    13. Re:Be careful by roman_mir · · Score: 1

      The problem is that you are left with a production environment in a state that is not supported by a production tag module in your source control system.
      Who can guarantee that what is in CVS for example is in production? Obviously this cannot be guaranteed without some sort of a process. I don't doubt that there are situations when this is the best working approach to deal with deployments given the other choices, but for most production systems this will mean production will be out of synch with code in the code control systems. I wouldn't want to see that happen too widespread, I already have to maintain many things other people create, I don't want to be also responsible for ensuring that what is dynamically loaded into production is exactly what is in the source control.

    14. Re:Be careful by ubikkibu · · Score: 1

      "it is never a good idea to modify code directly in production without running a full suit of tests against the code" Nice dodge and weave there. You should have stopped before your first comment.

    15. Re:Be careful by be-fan · · Score: 1

      I am insistant that in most cases this is counter-productive.

      I don't think you have enough (or any) experience with the feature to be able to make that sort of judgement. Live updates are a tool, like any other tool, they can be used poorly or well.

      One of the reasons is that you cannot know for sure what is running on production.

      It depends on the system. Commercial Smalltalk environments that support this feature let you introspect into the code running in the system. At the same time, proper configuration management tools can also be used to keep track of changes to live images.

      Let's just hope that the author of every change that goes to production spent time adding the change to the source control system of the code and that the code is tested before it is injected into production.

      The way these systems are usually used, the changes are entered into the source code of the system, and then incrementally compiled into the running image. Thus, you can SCM the change like any other source-level change. And yes, one would inject untested changes into a running system, but you have the same possibilities of putting untested changes into production even without live updates. You can't fix a people problem like this by eliminating an otherwise useful feature.

      --
      A deep unwavering belief is a sure sign you're missing something...
    16. Re:Be careful by abigor · · Score: 1

      You're right, you'd have to enforce this with some sort of process. But for systems that absolutely must not go down, it seems like a small price to pay.

    17. Re:Be careful by MenTaLguY · · Score: 1

      I'm not sure I follow -- I don't think the Erlang folks are suggesting that people upgrade some things and not others. Is your concern just that the upgrade from one tagged state to the next isn't atomic?

      --

      DNA just wants to be free...
    18. Re:Be careful by roman_mir · · Score: 1

      Don't care about the entire comment, since the following is false
      I don't think you have enough (or any) experience with the feature to be able to make that sort of judgement. Live updates are a tool, like any other tool, they can be used poorly or well.
      - it is false simply because of my sig. And if you don't get why, I won't be explaining. Cheers.

    19. Re:Be careful by be-fan · · Score: 1

      Have you used live updates in a Lisp, SmallTalk, or Erlang environment? If not, then what the hell are you squawking about?

      --
      A deep unwavering belief is a sure sign you're missing something...
    20. Re:Be careful by roman_mir · · Score: 1

      No, people are suggesting that it is a good idea to update code in applications in real time without a complete redeployment, which should include storing modifications that are going to be applied to production within some sort of a source control system, then installing the entire code base that will be deployed in production to some testing / staging environment, then moving code to production.

      I am saying that allowing deployments of a function or of a line of code to production needs to be done only in very special cases and controlled environments that have processes that allow for these kinds of modifications.

      Situation:

      1. Full deployment.
      2. A new requirement is created.
      3. Code is created to satisfy the new requirement.
      4. Code is placed into production by deployment of a dynamic function without a full deployment.

      Problem: ensuring that between the steps 3 and 4 there are more steps:
      3.1 Code is stored in the code repository (for example CVS.)
      3.2 The entire code base from the code repository is deployed to a test / staging environment.
      3.3 The tests are done, requirements are handled satisfactory and without bugs.
      3.4 The code in the code repository is tagged with a deployment number.
      3.6 Documentation is updated to state that the newest code to be placed onto production can be found under the newly created tag.

      If the steps between 3 and 4 are missed, then nobody will be able to say what is actually running on production.

      Even worse, if the deployment procedure relies on developers modifying code in production without a full deployment, so that only some functions are updated in memory, then certainly there will be situations when the developers will have the opportunity and desire to change the code even more, so that quick fixes are introduced into the production environment skipping any testing and possibly losing track of the changes in source control.

      Once this becomes the case, nobody can be sure that what is running in production is the same code that is in the code repository. I wouldn't want to maintain that kind of a system.

    21. Re:Be careful by roman_mir · · Score: 1

      Blow me, any process that allows developers to add code to systems in real time may and will produce situations where the production code is out of sync with the code in the source repository. That is a nightmare to maintain.

    22. Re:Be careful by roman_mir · · Score: 1

      ML, Scheme AND what you missed, you pompous buffoon, FF javascript modules in over 100,000 user installations.

    23. Re:Be careful by be-fan · · Score: 1

      What do any of these things have to do with live update in Lisp and Erlang? Look, I'm not questioning your experience in general here. What I'm saying is that unless you've worked with a live update system in one of the languages that treats live update as a core feature (Common Lisp, Erlang, and Smalltalk), you really are missing the perspective necessary to comment on the feature.

      Much moreso than ML, Scheme, or JS, Common Lisp, Smalltalk, and Erlang are languages for practical production work. A lot of experience with real-world systems have gone into the implementations of these languages, at multiple companies over a period of over two decades. All of this time, live-update has remained an important feature of these implementations. Either the idea is not as bad in production use as you seem to think, or the Lisp/Smalltalk/Erlang folks at Franz, LispWorks, Ericsson, Xerox, Apple, IBM, etc, are just misguided.

      --
      A deep unwavering belief is a sure sign you're missing something...
    24. Re:Be careful by roman_mir · · Score: 1

      Regardless of any feature provided by any language, any company that uses software for core businesses should have a deployment process. If the deployment process allows for real time updates of small portions of the code and all goes well because of the process every time and the systems are maintainable after all of this, then it works for them and there is no issue.

      My point is that I have seen vendors pushing forward ideas that Erlang must be used specifically because it has this feature. However the businesses themselves would not allow this and for a good reason. Most businesses don't have processes and all necessary components for this to work without causing major problems down the road, specifically by allowing such a feature the updates to production cannot be controlled and verified that what is in production is exactly what is in the source control.

      If it works for a business, good for them, it is only a tool to use for special purposes. Most businesses should stay out of this, because it will only bring them problems.

    25. Re:Be careful by Anonymous Coward · · Score: 0

      You're comparing Firefox to a development system for phone switches... Yes...

    26. Re:Be careful by Anonymous Coward · · Score: 0

      I guess you wouldn't mind your telephone being unavailable for a few minutes every now and then while your telephone provider restarts the exchange with a new version of the OS.

      This doesn't happen, because Erlang (and other systems) allow live updates.

    27. Re:Be careful by roman_mir · · Score: 1

      No I am not. The question was whether I have any experience with updating code on the fly in production. I said yes, I have, a few examples of that included code that does that specifically within FF browser. I am not talking about installing an extension either, just about injecting code into a live page and executing that code, that's what I had to do in that particular code.

    28. Re:Be careful by Anonymous Coward · · Score: 0

      You do understand there's a difference between a web browser and a telecom switch in terms of uptime requirements, right? RIGHT?

    29. Re:Be careful by roman_mir · · Score: 1

      I do, do you? If a browser goes down, who cares, if a switch goes down - that's an issue. I work for Bell ExpressVu through CGI right now, except for switches that probably do get updated in real time, there are thousands of other applications that do not use hot updates because the cost of maintenance goes up dramatically, especially if the production code gets out of sync with the code in the source control. The majority of applications in every business need to be maintained and for the majority of applications hot updates are not acceptable because they may lead to inconsistancies between the code repository and production and this is unacceptable. The level of involvement and the strictness of process for hot pluggable deployments has to be magnitudes higher than if hot updates are not used. Most apps cannot afford these kinds of costs and risks because most apps are not phone switches.

    30. Re:Be careful by k8to · · Score: 1

      Again this is irrelevant to the language feature.

      Systems which require reboots/restarts to update require testing and care to avoid problems on going live. This system which does not require a reboot/restart to update requires testing and care to avoid problems on going live.

      The difference is that going live does not require you to become not-live in the process!

      What is so hard to grasp here. You are complaining that this impressive technological achievement does not solve problems that it was not intended to solve, and that somehow because the process to validate correctness is not magically fixed, something is made worse.

      Nothing is made worse, all the existing tools a quality-oriented software house can apply will work. The improvement is that the eventual update can be made without bringing the system down.

      There are numerous *other* benefits to the language in question in terms of reliability, and conciseness which may lead to lower liklihood of problems regardless of this technological improvement. But you have yet to finger any actual problem other than your sense of worry over something you do not seem to understand.

      --
      -josh
    31. Re:Be careful by MenTaLguY · · Score: 1

      No, people are suggesting that it is a good idea to update code in applications in real time without a complete redeployment, which should include storing modifications that are going to be applied to production within some sort of a source control system, then installing the entire code base that will be deployed in production to some testing / staging environment, then moving code to production.

      I am saying that allowing deployments of a function or of a line of code to production needs to be done only in very special cases and controlled environments that have processes that allow for these kinds of modifications.

      Well, that makes total sense. The thing is that the Erlang/OTP Release infrastructure doesn't easily allow piecemeal updates; it's designed to enable full deployments with no (or minimal) downtime. You might be interested in reading about release handling principles under OTP. I'm sure the system can be abused, but it's not the free-for-all that some people seem to think.

      --

      DNA just wants to be free...
    32. Re:Be careful by abigor · · Score: 1

      Er...did you respond to the wrong person? I think my one-line post is in total agreement with what you said.

    33. Re:Be careful by k8to · · Score: 1

      Yes.

      --
      -josh
    34. Re:Be careful by Anonymous Coward · · Score: 0

      Dude - what are you talking about? Yes, you tag, bag and freaking test the living shit out of it first. What are you going on about? How and why would it not have a production tag in CVS, why would the QA, release engineering and production SA team allow untest, non-tagged, code onto a system with 12 layers of bureaucratic process, manned by numerous skill-less individuals, between a rogue piece of code and an innocent young server?

      The Ericsson AXD series switches have over 1.5 million lines of erlang code. New revs of that code, some of which is "live updated", probably spends 6 months to a year just being tested, rigorously, by different companies. No international telecomm is going to be chucking untested live code updates at their multi billion dollar infrastructure.

      There is no difference in having to stop a system and load new code (that is or is not tested and tagged) than to live update a system with tested, stamped, approved-by-the-tribunal, processed, six-sigmaed, TQM'd, agilely interated, waterfalled, tagged in CVS/SVN/git/hg/darcs code.

      Please stop, its like saying .war files are dangerous because they can update code on a server without stopping the Java process.

    35. Re:Be careful by Anonymous Coward · · Score: 0

      So as I said above, by your logic Java App servers are out because you can load a new .war file without stopping the JVM.

      You are repeating an argument that makes some weird magical distinction between the code quality and production release processes involved in a live code update vs a non-live code update. So what are the steps:

      1 dev code
      2 test
      3 send to QA for testing
      4 approvals, management bs...
      5 release packaging
      6 approvals for production update
      7 somehow get access to the production server where the code is running
      8 if not erlang and not java { stop process; load new code; start process }
            if java { load .war file; watch server comsume all available memory }
            if erlang { load new code using cryptic erlang commands }
      9 ???
      10 you know

      Regardless of if you do any of steps 2-6, if you can do step 7 - what the fuck is the difference between the erlang code update and the non-erlang code update? You are on the production server, you can do what you want. You argue that "most companies don't have ... process" - well if they don't have the necessary processes in place then anyone can update either type of code whether it has a CVS tag or not. I have worked at big and small companies - either they control the release process or they don't and it has zero to do with the method of code updates and/or content/data updates either.

  22. Re:Possibly the greatest programming book I've rea by BitGeek · · Score: 2, Insightful

    Programming Erlang is the best intro-to-new-programming language book I've ever read. By far. While erlang is radically different than previous languages I've learned, this book goes a long way to making the transition smooth.

    I'm still struggling, but I read the book with an application in mind, and have found its coverage is excellent... it brings you right up to the point that is needed for the other erlang documentation to be readable. (There are 60 some odd books on all the major components of erlang and OTP, including the major modules and APIs... they are downloadable from erlang.org)

    So, this book accomplishes its goal and really well. ITs not a shallow marketing piece about the language (as most books written by writers rather than programmers are) its a real how-to-program in erlang book and it does a great job of showing how you solve very difficult problems in erlang. It even has as examples things like full text indexing and map reduce.

    I think every programmer worth his salt should buy this and learn erlang-- the days of single core computing are over, and thus concurrency oriented programming is a critical skill to pick up, and erlang is the best language for it.

    --
    Yeah, and you guys panned the ipod too: http://apple.slashdot.org/article.pl?sid=01/10/23/ 1816257
  23. OOP to Erlang by chiph · · Score: 1

    The author here highlights one of the language features, the Erlang light weight process. These are true processes (not threads) but take up very little in the way of resources. Indeed it is not unusual to have 1000's of such processes running in an application.

    Would a good analogy be that an Erlang process is comparable to an object instance, in that both are loosely coupled (ideally), focused on one task (ideally), but in Erlang they're all running asynchronously and the OS/runtime automatically handles the communications for you?

    Chip H.
    1. Re:OOP to Erlang by MenTaLguY · · Score: 2

      Yes, that's a reasonably good way to think of them, with the proviso that an Erlang process doesn't bind particular code to the receipt of particular messages like you see in OOP (where particular bodies are bound to particular methods). When an Erlang process receives a message, it's up to the process to decide what to do with it.

      --

      DNA just wants to be free...
  24. Postblablurb by zeromorph · · Score: 1

    He's a loon with a large vocabulary.
    Or a loon with a recursive network. I recommend this instead.
    --
    "Hannibal's plans never work right. They just work." Amy/A-Team
    1. Re:Postblablurb by Fujisawa+Sensei · · Score: 1

      But the Postmodernism Generator makes more sense than the Loon.

      --
      If someone is passing you on the right, you are an asshole for driving in the wrong lane.
  25. Needs more on common libraries by vik · · Score: 1

    A great book on Erlang, but missing a few details on the usage of common libraries. In particular it could do with more information on how to drive the Mnesia database. I started programming Erlang a month ago and the shortage of implementation docs on the database and list libraries has been a problem for me.

    Yes, I do know about the Ericsson Mnesia manual and http://trapexit.org/

    Vik :v)

  26. ejabberd is written in Erlang by the_olo · · Score: 1

    It's worth noting that ejabberd is written in Erlang.

    For those who haven't heard about it, it's an open source, distributed, fault-tolerant instant messaging server (Jabber/XMPP), modular and very configurable and is readily available in most Linux distributions' repositories.

    It's one of the most promiment erlang-based projects.

    1. Re:ejabberd is written in Erlang by Anonymous Coward · · Score: 0

      With a language like that, I see why you need it to be fault tolerant.

    2. Re:ejabberd is written in Erlang by Anonymous Coward · · Score: 0

      I think you really should dig into Erlang and/or ejabberd. The fault-tolerance feature in ejabberd is in fact a feature of Erlang. No code was written for this by the ejabberd project. Your comment really looks stupid if you know this fact...

  27. With a name like erlang by Anonymous Coward · · Score: 0

    ...YAWN...

  28. Check it out at the shootout by Hoplite3 · · Score: 1

    It's worth looking at

    http://shootout.alioth.debian.org/gp4/benchmark.ph p?test=all&lang=hipe&lang2=hipe

    for the general performance of erlang. It compares unfavorably in those tests to lisp and clean, two other functional programming languages.

    --
    Use the Firehose to mod down Second Life stories!
    1. Re:Check it out at the shootout by Eideewt · · Score: 1

      Erlang isn't aimed at the same niche though. Neither Lisp (barely a functional language to begin with) nor Clean is meant for extreme multiprocessing. I don't believe Clean supports loading code into a running system, although it may become possible with the upcoming dynamic linker.

  29. Full-time Erlang programmer gives his view :] by pnis · · Score: 2, Informative

    As somebody writing code in Erlang as a profession, I say, though it has strength, it's crap. It has strength in the efficient handling of many processes (faster then the OS when there are many many thousands of them), aand (re)loading modules on the fly into the virtualmachine is nice. But on the flipside Erlang is slow as it's a very high level language, with a not so clever virtual machine - much less so than java vms (well I have to admit I am an assembly&C fan). Also functional programming my ass. In reality it's more like very basic barebone declarative programming, where you can only use global variables (mnesia database, and in worse cases the process dictionary) and there are no loop constructs (you can only use ugly additional functions and recursion instead of a "for" construct). Well, at least this is my opinion.

    1. Re:Full-time Erlang programmer gives his view :] by ubikkibu · · Score: 1

      You seem to be complaining that Erlang isn't purely functional enough, and I've heard this criticism from Haskell and other people. But then you decry the lack of loops and bemoan that you have to arrange function clauses for tail recursion instead.

      I think these two assertions collide.

    2. Re:Full-time Erlang programmer gives his view :] by pnis · · Score: 1

      I don't know what a good functional language is like, but erlang is declarative with only global variables and no "for". If a good functional language is a declarative language with only global variables and no "for", than I have no complaints.

    3. Re:Full-time Erlang programmer gives his view :] by MenTaLguY · · Score: 1

      Ideally, in functional programming you want to use neither loops nor explicit recursion for iteration, but combinators instead. I've seen a lot of Erlang programs unnecessarily using explicit recursion, though. They ought to have provided a standard looping/iteration combinator (besides map) in the standard library, but there's nothing preventing you from writing one for yourself (using recursion) and using that everywhere rather than trying to work with explicit recursion everywhere.

      --

      DNA just wants to be free...
    4. Re:Full-time Erlang programmer gives his view :] by MenTaLguY · · Score: 1

      Ah, actually they do provide. Just takes a little digging in the standard library that I guess most people don't do.

      --

      DNA just wants to be free...
    5. Re:Full-time Erlang programmer gives his view :] by MenTaLguY · · Score: 1

      Well, ideally it wouldn't have global variables either. :)

      What sort of uses of "for" did you have in mind, though? Erlang provides lists:foreach and lists:map in the standard library, which covers many typical uses of "for" in other languages.

      --

      DNA just wants to be free...
    6. Re:Full-time Erlang programmer gives his view :] by pnis · · Score: 1

      What combinator did you find in the standard library? Anyhow, you are right, and I am aware of the fact that people should use these combinators. But it did happen that I had to use an additional function and recursion (instead of "for"). Maybe I didn't study the documetaion well enough - although one of my startpages in my browser is exactly http://www.erlang.org/doc/, and I have studied it some time.

    7. Re:Full-time Erlang programmer gives his view :] by MenTaLguY · · Score: 1

      lists:foreach, in conjunction with lists:seq, seemed like enough to cover most (though not all) typical "for" cases. I suppose in some cases (like iteration over a large range of integers), it'd still be desirable to write your own combinator, e.g. something like:

          forseq(Fun, Start, Limit) when Start < Limit ->
              Fun(Start),
              forseq(Fun, Start + 1, Limit);
          forseq(_, _, _) -> {}.

      Either way, it shouldn't be necessary to use explicit recursion in the main portion of your code, and very seldom will explicit recursion be the clearest way. Would you be willing to paste an example of the kind of structure you were having trouble with? I can either help you out or be proven wrong by example. :)

      --

      DNA just wants to be free...
    8. Re:Full-time Erlang programmer gives his view :] by pnis · · Score: 1

      Unfortunatelly I don't remember what was the exact code, I will try to look it up tomorrow. I hope I won't be proven wrong, because in fact I was aware of and have studied these list:* functions.

    9. Re:Full-time Erlang programmer gives his view :] by DaveTerrell · · Score: 1

      If you really are a professional erlang programmer, you're not a very good one.

      You can use list recursions or lists:map/lists:foreach to iterate over lists without having to do stock tail recursion.

      "you can't use global variables".

      Its support for gotos is also, sadly. limited.

      The standard way of stashing global state is to use a named process gen_server, which is the equivalent of a singleton. This works fine.

      The process dictionary is completely useless as global variables, it's per process! That's like saying you can pass around pointers to the stack instead of heap allocating...

      How long have you been doing erlang work? 3 days?

    10. Re:Full-time Erlang programmer gives his view :] by dargaud · · Score: 1

      I tried Erlang last year, trying to preemptively find a possible 'multi-core aware' language for the future. I'm not used to VM languages so my first question was 'how do I make a self contained executable with that thing?'. I failed to find a way. Then I tried to understand the difference between the language threads and the OS threads and it appears the former are contained in the VM, so any optimisation is then linked in how well the VM fits into the OS, i.e. not well at all. Then final straw, the development environment was abysmal (think VT100 terminal mode). When we start seeing plugins for KDevelop, Eclipse or (Gates forbid) Visual Studio, with nativev threads, then we'll talk.

      --
      Non-Linux Penguins ?
    11. Re:Full-time Erlang programmer gives his view :] by pnis · · Score: 1

      Ok usually these things can be done with these combinators. It might become a bit too convoluted though for my taste. Also as far as I can see you can't stop working through a list in the stock combinators, even if you know you should stop processing no - this is ugly IMHO.

    12. Re:Full-time Erlang programmer gives his view :] by pnis · · Score: 1

      I must have hurt your feelings badly, or why the ad hominem attack?
      I have been doing erlang work for 1.5 years. I am not only taking about what I have written, but also what I see all the time in all the code - i.e. how erlang is actually used in practice.
      I said, all you can use is gloval variables. This indeed is true, as far as in all the code I see, people shove everything up in a mnesia database (=global variables). But you are right process dictionary is not global, but it does make the code a mess if not used with enough caution (and why would it be).

      Thanks for your comments, I hope one day I can be becomae as good an erlang programmer as yourself.

    13. Re:Full-time Erlang programmer gives his view :] by Anonymous Coward · · Score: 0
      I wonder what you would type into Google to find an Erlang plugin for Eclipse? Might "Erlang plugin for Eclipse" work, perchance?

      The point of the SMP emulator is precisely to integrate Erlang processes well with OS threads.

    14. Re:Full-time Erlang programmer gives his view :] by MenTaLguY · · Score: 1

      Had you considered using lists:dropwhile?  It's effectively like lists:foreach, except that it expects a function returning bool() and stops as soon as that function returns false.  It might make sense to wrap it in a more appropriately-named function for readability's sake, though:

      foreachwhile(Fun, List) ->
         lists:dropwhile(Fun, List),
         void.

      For more complex cases, you can often preprocess the list with lists:takewhile, lists:filter, etc.; breaking your list processing into a pipeline with several stages can often be a good strategy.  Generally, the one thing that stdlib is missing is a short-circuiting fold:

      foldlwhile(Fun, Acc0, [Elem|Tail]) ->
         {Continue, Acc} = Fun(Elem, Acc0),
         if
           Continue -> foldlwhile(Fun, Acc, Tail);
           true -> Acc
         end;
      foldlwhile(_Fun, Acc0, []) -> Acc0.

      It's not needed in a lazy language like Haskell, but I would miss it occasionally in a strict language like Erlang.  This is a case where it would need to be a custom job; the best you could do atop stdlib would be something like:

      foldlwhile(Fun, Acc0, List) ->
         element(2, lists:foldl(fun (Elem, {true, Acc}) -> Fun(Elem, Acc);
                                    (_, result)         -> result end,
                                {true, Acc0}, List)).

      Regardless, if you find yourself needing explicit recursion, try refactoring it out into a custom combinator.  If your experience is like mine, you'll likely find there's a small set of them which you use on a regular basis, and possibly that some of them correspond to combinators already in stdlib.

      --

      DNA just wants to be free...
    15. Re:Full-time Erlang programmer gives his view :] by pnis · · Score: 1

      I admit, I was wrong about the "for" loop stuff (although the standard library does lack some usefull combinators). The thing is, in my 1.5 years nobody told me that the essence of functional programming is the lack of loops but using these combinators instead. So I have learnt something new here, thank you for the insight.

      But still taking out my gripe about the lack of "for" loop (sorry but I am accustomed to imperative programming, I grew up on Assembly :) ), what weaknesses I wrote about Erlang - or at least for the pieces of code I have seen in Erlang - still stand imho.

      btw are you the Mentalguy mentioned in the mikmod credits ?

    16. Re:Full-time Erlang programmer gives his view :] by MenTaLguY · · Score: 1

      The thing is, in my 1.5 years nobody told me that the essence of functional programming is the lack of loops but using these combinators instead. So I have learnt something new here, thank you for the insight.

      You're welcome; it's an insight that made a big difference for my own programming when I finally grasped it, and I'm glad to pass it on. It's sort of obvious in retrospect: recursion is just the dual of iteration, and the whole point of functional programming is being able to capture concepts as higher-order functions. But in reality it took me a lot longer than 1.5 years to really "get" that.

      But still taking out my gripe about the lack of "for" loop (sorry but I am accustomed to imperative programming, I grew up on Assembly :) ), what weaknesses I wrote about Erlang - or at least for the pieces of code I have seen in Erlang - still stand imho.

      I agree with you on some of them, too. The VM and network protocols in particular are woefully under-documented and rather crufty. I've also been pretty unimpressed with the little bit of Erlang code that I've seen (at low levels, anyway; the overall architecture of things can be quite nice). But the declarative thing touches on another essence of functional programming: ideally, functional programs don't change things as side-effects of their evaluation, but they declaratively describe the mapping from old states (as parameters) to new states (as results). I think one of Erlang's weaknesses is that in some ways it is neither fish nor fowl: the language itself is quite functionally "pure", but important parts of the standard library (actors, IO) still aren't. Imperative techniques are implicitly encouraged in a language that doesn't really support them.

      btw are you the Mentalguy mentioned in the mikmod credits ?

      Yes, that's me. Kevin Vance and I contributed the loader for the GDM format; I reverse-engineered and documented the format (using the existing documentation as a starting point), and Kevin did most of the heavy lifting.

      --

      DNA just wants to be free...
    17. Re:Full-time Erlang programmer gives his view :] by White+Flame · · Score: 1

      Native threads are a significant limitation, generally requiring manually tuned threadpooling, shared work queues and synchronization states, and other garbage in other languages to keep them running. Erlang is meant to run thousands to hundreds of thousands of processes in parallel in a single VM, with super fast process creation, destruction, and switching. An implementation using native threads for Erlang processes would choke and thrash so horribly it would be unusable. The VM runs enough native threads to match the SMP core count as it drives its Erlang processes, so you get the full parallelism gains of your hardware.

  30. CouchDB was written in Erlang by dominux · · Score: 1

    to give you an example of something built in Erlang take a look at http://www.couchdb.com/ CouchDB is an Open Source (GPL) database back end. It is in some ways inspired by the database architecture of Lotus Notes, it is a non-relational document based store with strong replication ability. Don't bother bitching about Notes, the new UI is quite different to the old look (personally I liked the old style) but CouchDB doesn't have a UI, it has similarities at the architecture level which is where Notes is very very good indeed, and CouchDB is better.

  31. Lisp, you say? by SanityInAnarchy · · Score: 1

    I'll have to check it out again.

    What are the options for compilation? Anything beyond simply distributing source code?

    --
    Don't thank God, thank a doctor!
    1. Re:Lisp, you say? by TheRaven64 · · Score: 1

      Lisp still tends to be distributed as source code. The best Common Lisp compiler last time I checked was Steel Bank Common Lisp, which compiles to close to native speed.

      --
      I am TheRaven on Soylent News
    2. Re:Lisp, you say? by be-fan · · Score: 1

      Compilation-wise, it depends on the compiler. Any compiler will let you distribute what's called a FASL (a compiled image of a file). Command line options to the Lisp program will then let you load these fasls (this can be wrapped in a script). Some compilers (Allegro, LispWorks, Corman, ECL) will let you generate native executables.

      Some suggestions: If you're already an Emacs maven, SLIME is a good idea. If you're not, LispWorks has a free demo with IDE that's quite nice. If you're on Windows, Google "Lisp in a Box" for some pre-packaged environments with SLIME. Compiler choice depends on platform. On *NIX, SBCL is the obvious free choice, and Allegro and LispWorks are good for-pay options. I can't really say what the situation is on Windows (I use SLIME/SBCL on a Mac), but you can probably ask on #lisp.

      --
      A deep unwavering belief is a sure sign you're missing something...
    3. Re:Lisp, you say? by poopdeville · · Score: 1

      I don't mean to butt in with a contrary opinion, but have you looked into Scheme lately? There are several Scheme -> C/native code compilers available. http://community.schemewiki.org/?category-implemen tations

      --
      After all, I am strangely colored.
    4. Re:Lisp, you say? by SanityInAnarchy · · Score: 1

      By all means, but in.

      But, could you please explain what's different and special about Scheme? At first glance, it looks like yet another Lisp dialect.

      --
      Don't thank God, thank a doctor!
    5. Re:Lisp, you say? by poopdeville · · Score: 1

      Yes, it is just a Lisp dialect. Common Lisp is the other major dialect. First, note that Common Lisp's specification is around 1300 pages long. Scheme's is about 70. Obviously, CLisp has more features "built in" to the language. It also has better support for macros. However, Scheme's weaknesses aren't so weak in practice. Most Scheme implementations come with de facto standard libraries implementing most of CLisp's extras. Macros are kind of a big deal, but Scheme does support them. On the other hand, Scheme supports continuations, which CLisp cannot.

      I personally like Scheme because I was looking for a good functional/OO language. Scheme was originally designed to study the Actors model of computation (a kind of message passing OO model), and obviously has strong functional support. It's small and easy to learn. CLisp just looked intimidating to me. :-)

      --
      After all, I am strangely colored.
    6. Re:Lisp, you say? by Watson+Ladd · · Score: 1

      Scheme has one namespace, Common Lisp has 2. Scheme has call-with-current-continuation, Common Lisp does not. And the Scheme standard fits in the index of the Common Lisp standard. Scheme is also much cleaner then Common Lisp as (not (eq? nil #f)) for example. Scheme implementations have many different flavors, from category-theoretical, to smalltalk-like. Common Lisp is pretty much Common Lisp.

      --
      Inventions have long since reached their limit, and I see no hope for further development.-- Frontinus, 1st cent. AD
    7. Re:Lisp, you say? by Eideewt · · Score: 1

      I've got to butt in too. Abbreviating Common Lisp as CLisp is confusing and wrong. CLISP is a Lisp implementation. Common Lisp is abbreviated CL.

    8. Re:Lisp, you say? by poopdeville · · Score: 1

      Sorry, didn't know.

      --
      After all, I am strangely colored.
    9. Re:Lisp, you say? by Eideewt · · Score: 1

      You're not alone. Lots of people who aren't really familiar with Lisp do the same thing.

    10. Re:Lisp, you say? by be-fan · · Score: 2, Interesting

      Scheme and Common Lisp are both Lisp dialects, but both have very different cultures behind them. Major differences (very CL-biased):

      - Common Lisp was designed with a strong bent towards practical utility. It has a lot of features* and features that aren't necessarily clean**, but are included because of usefulness or backwards compatibility reasons. Scheme was designed first and foremost to be a very clean, pure language. It's easy to learn, and you can hold the whole thing in your head without much effort.

      - Common Lisp is a big standard, which means practical code can be written without implementation-specific libraries. Scheme code tends to depend heavily on implementation libraries as a result of a smaller standard. In _practice_ there is a fairly substantial body of portable Common Lisp libraries. In _practice_, most Scheme libraries tend to be fairly implementation-specific, though some implementations (PLT, Chez) have rather extensive libraries. CL has Cliki and ASDF, which gives you CPAN-like installation of a fairly nice set of libraries. I don't believe Scheme has anything similar.

      - Common Lisp is a multi-paradigm language. It supports functional programming, imperative programming, and OOP. It has really good iteration constructs (LOOP, Iterate package), and a good object system (CLOS). Common Lisp programmers tend to write code that's a mix of functional and imperative styles. Scheme is decidedly a functional language. It has no object-system built in, no fancy iteration constructs built in, and Scheme programmers tend to write code in a very functional style.

      - Common Lisp is in practice faster. It has features like optional declarations to help out the compiler, and the native-code compilers for CL have had a lot of work put into them. Scheme is also quite fast, but I don't get the impression that Scheme implementations (except maybe for the commercial Chez Scheme) are in the same league.

      *) Package (module) system, CLOS, generic sequences, LOOP, etc.
      **) Scheme has one namespace for functions, values, and types. Common Lisp has multiple namespaces. In CL, you can name a variable "list", without worrying about it conflicting with the function "list". The syntax disambiguates the uses. Also, Common Lisp has a low-level, procedural macro feature. You can use the full language during macro-expansion (say to expand the macro differently based on the contents of a file). In Scheme, you get a weaker, but safer, template substitution-based macro system.

      --
      A deep unwavering belief is a sure sign you're missing something...
  32. That's a joke, right? by ubikkibu · · Score: 1

    Seriously, is it? Because those criticisms are pathetic, and two contradict each other.

    I'd actually like to read a serious criticism of Erlang. I finished "Programming Erlang" on Sunday, and like many folks, I'm mildly jazzed about Erlang. The syntax hurts somewhat, but then again I spend all day coding Python. And while I can think functionally somewhat, I have a hard time imagining larger systems without OOP, but that's probably my lack of experience.

    I'm ready to do something good with Erlang, but I'd like more contrary opinions before I do so.

    (The book was outstanding--a pleasure to read.)

    1. Re:That's a joke, right? by TheRaven64 · · Score: 2, Informative
      Erlang is actually the closest language I've seen to the original meaning of Object Oriented Programming; Alan Kay's simple computers communicating via message passing. The syntax varies from absolutely gorgeous (anything involving binary data) to just plain painful (metaprogramming, string manipulation, ADTs, etc). The foreign interface layer is horrendously badly documented, and has enough overhead that it's hard to use it for the one thing where it would actually be really useful: serial code that needs to be fast.

      Back to the point, you can do most of the OOP things you might want to do if you just think 'object equals process'. Erlang is really nice for some things (I had a project that wanted to run on a 64 CPU machine, and Erlang was great for that), but it could be a lot better. R11 improved things a lot over R10 though, so I'd definitely recommend learning it. Even if you don't use it much, I think knowledge of Erlang improves your ability to program in other languages, just as Lisp and Smalltalk do.

      --
      I am TheRaven on Soylent News
    2. Re:That's a joke, right? by Anonymous Coward · · Score: 0

      > I'd actually like to read a serious criticism of Erlang.

      String munging is serious pain. Despite every char being 32 bits, unicode support is nonexistent.

      It's duck-typed, which many consider a big feature, but others consider a minus. Certainly it doesn't make the job of an optimizing compiler easy (but HiPE manages anyway).

      It isn't particularly object-oriented. Now in some ways, it's insanely OO like smalltalk, because of the message-passing, but whereas smalltalk has actual classes, erlang has modules in which you stick functions, and you're just going to sling untyped tuples and lists around for your structured data. It hasn't really hurt erlang in its niche where objects model processes, but where objects model data, it's hurt, especially when subtyping is involved.

      Its library support is often lacking -- you may not find a good RDBMS library for example because everyone would insist you use mnesia instead. It's still big, but it's nothing compared to perl or python or java (but you can run an erlang node in java!)

  33. If only "Pro Django" had gone with PP by ubikkibu · · Score: 1

    The "download PDF first, get dead tree later" approach is a huge winner for tech books. I did the same with "Programming Erlang," and it allowed me to get through the first few chapters on my iPhone (Safari does some magic that renders PDF very well), then read the rest on paper. Then I read Chapter 8 online again because I'd left the book home. Very convenient, and closer to Instant Gratification.

    I'm probably not the only one waiting (and waiting...) for djangobook.com to get published finally, but a 2/3 finished PDF would have made me 2/3 happy in the interim.

    1. Re:If only "Pro Django" had gone with PP by daeg · · Score: 1

      I think the problem with djangobook is that they wanted to get some of the sweeping changes done first for the 1.0 release: unicode merge, newforms, and newforms-admin. I think the core developers ran low on time on those branches and 1.0 hasn't come as soon as they had hoped. At least thats what it feels like.

      That said, I still love Django. I just wish there were more available Django developers. The media companies keep stealing them. :-(

  34. Have you ever written a loop? by Estanislao+Mart�nez · · Score: 4, Informative

    It's very different, but the big advantage is that it's higher level than the stuff you confess to understanding better.

    The code in question (in Python? not a great choice for doing an example!) uses two very common higher-order operations in functional programming: map and compose. A map operation takes a complex data structure (most common example: a list), and a function that applies to elements of that data structure, and returns another structure, with the same "shape," where each element in the result is related to its corresponding element in the original structure by being the result of apply the function. Thus, if you have a list [2, 3, 5, 7], and a function inc that increments a number by one, map(inc, [2, 3, 5, 7]) evaluates to [3, 4, 6, 8].

    In the case of a list, map is can be implemented by creating a new list of the same length as the original, looping over the list, applying the function to each value, and storing the result in the result list. This is a kind of task that imperative programmers find themselves doing all the time. The problem with this, however, is that if you're writing code like this all the time, you're writing at a much too low level, with the all the disadvantages of that:

    1. It takes you longer to write code. Instead of writing just result = map(fn, myList), you have to write a loop.
    2. Your code is specifying the mechanism to convert the input list into the output list over and over, instead of describing the relation between the lists. Suppose you want to change the mechanism for doing this sort of operation, e.g., to parallelize it. In functional style, you can just rewrite map to do its work in parallel. In imperative programming, you have to work harder.
    3. The concept of mapping a function over a structure, to produce a new structure with values related to the original by the function, applies to many kinds of data structure, not just sequences. You can write equivalents of maps for any container data function you like, even though the mechanics are different; e.g., to implement a map function over a tree you typically use recursion. This means that in the imperative style, the code for "increment all the values of this list by 1" looks very different from the code for "increment all values in this tree by 1"; in functional programming, they will at least look very similar, if not completely the same.
    4. There are many, many other common progamming blocks that you can abstract into a function in functional programming, but not in imperative programming. For example, filtering a list to only keep the elements that satisfy a boolean function, which in functional programming is usually just a function called something like filter. For example, if you have a function called even, that returns true only for even numbers, here's how you get the even numbers in myList: filter(even, myList)
    5. Functional programming solutions often compose more easily than imperative ones; i.e., it is easier to put them together to solve more complex tasks. For example, if you need to increment a list of numbers by one each, and only keep the ones that are even in the result, you can do that easily and transparently: filter(even, map(inc, myList)). In the imperative style, the patterns for mapping and for filtering don't combine this straightforwardly.
    6. Functional code is usually easier to read. When I read a piece of imperative code and come across a loop, I normally have to work the steps a bit in my mind in order to see what it is that it does: "Hmm, we create a new list at the beginning, then we loop through the elements of this other list, and as we go through each one, we apply a function to it, and put the result in the list we first created. Ah, we're mapping over the list." In functional programming, these common patterns find immediate expression in a higher-order function
    1. Re:Have you ever written a loop? by nacturation · · Score: 1

      Thanks for writing that -- I've not dabbled much with functional programming, but your explanation is quite clear and concise and makes me want to give it a shot!

      --
      Want to improve your Karma? Instead of "Post Anonymously", try the "Post Humously" option.
    2. Re:Have you ever written a loop? by caroleonne · · Score: 1

      Free tv stream live movies on netcoves.tv
      Free sex tv stream and live XXX movies on netcoves.com

  35. No, not a "good idea," by ubikkibu · · Score: 1

    live code updates are an up-front requirement for the domain Erlang addresses. Google "nine nines" if you don't understand why.

    1. Re:No, not a "good idea," by nacturation · · Score: 1

      live code updates are an up-front requirement for the domain Erlang addresses. Google "nine nines" if you don't understand why. The supposed 35 milliseconds of downtime per year is largely anecdotal according to Armstrong's 2003 thesis:

      "Evidence for the long-term operational stability of the system had also not been collected in any systematic way. For the Ericsson AXD301 the only information on the long-term stability of the system came from a power-point presentation showing some figures claiming that a major customer had run an 11 node system with a 99.9999999% reliability, though how these figure had been obtained was not documented."

      Regardless of how such an uptime can possibly be measured to any degree of accuracy, I think the point is still valid that it can produce quite reliable systems.
      --
      Want to improve your Karma? Instead of "Post Anonymously", try the "Post Humously" option.
  36. Well, since you say it's impossible, by ubikkibu · · Score: 1

    I must assume it's actually trivial and obvious.

  37. classic papers by rsilverman · · Score: 2, Informative

    Here is a classic paper on the style and advantages of functional programming:

    http://www.math.chalmers.se/~rjmh/Papers/whyfp.htm l

    Also, John Backus' Turing Aware lecture, "Can Programming Be Liberated from the Von Neumann Style?"

    http://www.stanford.edu/class/cs242/readings/backu s.pdf

  38. Erlang rocks! by Anonymous Coward · · Score: 0

    Whatever it will be - Erlang or Scala, functional languages are getting more demand. No wonder. If you've been developing large information systems that must scale and be reliable (by definition) you already know why. In year 2007 it's a new "java" indeed. And for the first time in the last 10 years, I was finally having a huge fun learning new programming language. Great author, great book, great language.

  39. Erlang infringes on my intellectual property! by operagost · · Score: 0, Troll

    The chapter also starts us into the strange world of functional programming, where variables can only be given a value once
    I developed and patented those years ago! I call them "constants"!
    --

    Gamingmuseum.com: Give your 3D accelerator a rest.
  40. Deadpanning it. by Mr+Z · · Score: 1

    "Last" as in "most recent", not "last" as in "ultimate" or "final."

  41. Perfect timing! Meet Nick. by Just+Some+Guy · · Score: 1

    An article on functional programming is the perfect time to introduce my new son, Nick, to Slashdot. Previous releases were in C, Perl, and Python. Since Nick's functional, this one is in Lisp.

    Mod me up or my son will spit up on you.

    --
    Dewey, what part of this looks like authorities should be involved?
  42. Imperative, OO, Functional, and Logic by tknd · · Score: 1

    For my bachelor's I was required to take a Programming Languages course. Unfortunately, I'm finding many other students that went to other universities don't have the same requirements or the same type of professor I had.

    The course covers different areas of programming languages: imperative (C, Perl, basic), object oriented (C++, Java, Smalltalk), functional (lisp, scheme), and logic (Prolog). My professor did the smart thing (or the thing he liked the most if you want to look at it from another perspective) and started the course by teaching Prolog. Everyone up till this point had been exposed to imperative and OO programming styles so Prolog even for me was very new. But it made the other thing CS students cringe on much easier. That other this is pure functional languages like pure Lisp and pure Scheme.

    Very briefly, Prolog is a logic based language. What you're used to and what most of the world uses is some mixture of imperative programming and OO programming (though that's slowly changing). In those types of languages it's basically like coming up with a set of steps to execute in order to perform some operation of algorithm; you think in the order in which you would perform the operation most of the time. Prolog is completely different. Instead, you take a more mathematical approach and come up with a set of rules. A common problem that's easily solved in this manner is explaining a family tree with a grandparent relationship. In a logic based language, the procedure is something like:

    1. define a parent to child relationship (example: John is a parent of Chris, John is aparent of Jane, Chris is a parent of Amy)
    2. define the definition of a grand parent ( a parent of a parent is a grandparent )

    Once that's completed, then you "ask" the program for rules that are true and it should return true or false. So in the above examples, I could ask "is John a grand parent of Amy, and prolog would return true, and I could also ask "is John a grand parent of Jane, and prolog would return false. There was never an instance of the programmer defining anything except logic based rules. However, because of this, the program can now answer all questions that fit within that set of rules. As you might imagine, when you are trying to implement not so trivial things like sorting lists, logic based programming gets really strange to think in.

    But that strangeness pays off because at some point you will have learned essentially what you needed to get by in functional programming: recursion. Everything in functional programming is done by recursion and as you might guess functions. In "pure" functional programming, there is no such thing as a "variable". All functions operate on a list data structure with functions that only allow you to access the head item the next item because by definition, you could just keep taking the next item to traverse the list. Functional programming isn't actually that bad once you've gotten your head over how to use recursion to replace almost any loop.

    For example lets take adding all the numbers in a given list with only functions. In the imperative style you'd probably use an accumulator just as you normally do when you physically add numbers:

    accumulator = 0
    foreach number in list
    accumulator = accumulator + number

    However in functional programming, we have no variables and we have only have functions. Therefore, we need to define what it means to add the numbers in a list using functions and recursion:

    function add (a b) (return a + b)
    function sum (L) (
    return add(head L, sum(next L)))

    Psuedo code aside, all I have are two functions, the first is basically the definition of addition. The second is the definition of adding numbers in a list in terms of recursion. In English, that is: the sum of a list of numbers is the first number in the list plus the sum of the remaining list of numbers.

    Re

  43. "COSA Killer" by ubikkibu · · Score: 1

    Oh my god, that's the funniest thing I've read today. "COSA killer." Duke Nukem Forever, dooood!

  44. Erlang sucks by Anonymous Coward · · Score: 0

    Erlang sucks nuff said. Posting as Anonymous Coward is the only way to get any sort of modding. If it's flamebait so be it. You moderators suck!

  45. threads, not processes by WamBamBoozle · · Score: 1
    Erlang uses POSIX threads to manage more erlang threads. They are not processes. Of course, POSIX threads are implemented on top of system threads which are implemented on top of the scheduler which may or may not be scheduling multiple cores. The wonderful thing about Erlang and logic programming languages in general is that they can be understood as applications of rules. They are Applicative. If you have a predicate

    a:- b, c.
    a:- d, e.
    There are two kinds of parallelism available here: or parallelism and and parallelism. A clever scheduler can arrange for the subgoals b, c, d, and e to run in parallel. An or parallel implementation would attempt to prove (b,c) concurrently with (d,e) and an and parallel implementation would attempt to prove b concurrently with c and then, if either or both of those failed, would attempt to prove d concurrently with e. The fun begins when variables are shared across the subgoals. Scheduling can get very interesting then. Erlang gave up on that and instead insists that you schedule it yourself and then gave you good primitives to do so.
  46. Re:Glad to see Erlang finally getting some attenti by Anonymous Coward · · Score: 0

    Ocaml doesn't support true concurrent programming. Threads in Ocaml will only run one at a time, even if you have 80 cores. Apparently, it's a deficiency of the garbage collector they use. Jocaml is an Ocaml extension to support concurrent and distributed programming. Speed-wise, wasn't there some controversy over the benchmarks testing more of the performance of Ocaml's imperative features rather than its more interesting functional programming features?

  47. Programming languages based on English by tchuladdiass · · Score: 1

    I've put some thought into this particular topic a while ago. I wondered what it would be like to have a computer language that didn't use english (or any human language) tags for it's keywords. The thinking was, what is easier to read or write: 1 + 2, or 1 plus 2? To me, the symbol form seems more natural.
    An example of using symbols where you would normally have a keyword is in C's conditional expression, " x y ? z : n ", which is read as "(if) x y (then) z (else) n". What if this syntax was used wherever an if/else pair is used, would it be more readable? And, can it be extended to loops, so that you had an iterative inline conditional, such as "x y ?? z : n", which is read as "(while) x y (do) z (else) n", where the "else" clause is executed only if the initial condition started off false. So the entire expression returns eiter the final result of z, or n in the case that z never gets evaluated.
    So to try this out, I started putting together an interpreter that used this syntax (it's on lang2e.sourceforge.net if any one is interested). So far it seems to be working out ok, but the one area that I couldn't get away from using english keywords is in the standard function library. But technically that isn't part of the core language definition, but it is included with the base interpreter.

    1. Re:Programming languages based on English by OrangeTide · · Score: 1

      lisp is mostly symbolic. Although people have English words for many symbols due to limitations of ASCII.

      I like your ??: syntax, mind if I steal it for my own compiled language (not an interpreter)?

      --
      “Common sense is not so common.” — Voltaire
    2. Re:Programming languages based on English by tchuladdiass · · Score: 1

      Sure, no problem. In return, I'm looking for a proper symbol to represent a "continue" and "break". I'm thinking of !: for break, and !? for continue, but asthetically that doesn't look right (too hard for the eye to catch in the code). The way break and continue would work, is they will be implimented as unary operators (most like unary postfix), where the operand of a "continue" operator will be the return result of the expression if the condition is false on the next evaluation, and the operand of the "break" ends up being the final result of the iterative conditional expression if it is used.

      Also note that in both the conditional and iterative conditional, if a lower precedence operator is encountered before the ":" (else) operator appears (or and unmatched closing parenthese), it automatically assumes a ": 0" sequence (else zero). So that you don't have to always specify an "else" if you are using this control structure outside of a larger expression. This is explained further in the documentation on the project page.

      BTW, I've set up the interpreter to be useful as a teaching tool to go along with a paper I'm writting up as a tutorial on putting together an interpreter. I've got another round of cleanup work to do on it before it becomes useful for that purpose, but feel free to grab any ideas from there you need.

    3. Re:Programming languages based on English by OrangeTide · · Score: 1

      /^ and /, for continue(back to top) and break(to the bottom). or maybe v instead of , ?

      sounds good though. I'll have to read it over soon :)

      --
      “Common sense is not so common.” — Voltaire
    4. Re:Programming languages based on English by ChrisMaple · · Score: 1
      I like the idea of using symbols instead of keywords more often, but ASCII is weak in the symbol department. In particular, good use could be made of arrows in at least four directions, and open and close roof and floor symbols. I'd also like to see a keyboard that included such symbols. And a nice font set. And a language that used the symbols. And ....

      In a sense, APL was a step in that direction, but overstriking to create symbols was a nuisance.

      --
      Contribute to civilization: ari.aynrand.org/donate
    5. Re:Programming languages based on English by tchuladdiass · · Score: 2, Interesting

      I kind of like what Donnald Knuth had proposed, which is using a typesetting system to display code. So you'd use regular ascii symbols that are close to what you want when typing it out, but they get converted to a more graphical symbol in your editor automatically.

  48. Eh, no by Estanislao+Mart�nez · · Score: 1
    1. Map isn't necessarily a primitive.
    2. You want to be able to write your own higher order functions anyway, and you want to be able to debug them.

    It's still a pretty minor point, because it's really easy to write functions like map, to understand them, and to unit test them. In fact, this makes the functional program easier to debug. When you split out your "looping" into a generic higher order function to provide the structure, and an argument functions to provide the case-specific logic and transitions, you can test them independently.

  49. Are Erlang programs awash in race conditions? by Anonymous Coward · · Score: 0

    With "threads" or "processes" to do every little task, you might end up with hundreds of these things racing against each other. These "processes" need coordination. What control mechanisms does Erlang offer to prevent race conditions?

  50. Funny not Flame by toddhisattva · · Score: 1
    How could a mod call this a flame?

    It shares half a shelf with the Standard ML and Haskell books. The other half taken up by the shrink wrapped "The Art of Computer Programming" that has been sitting on there since the store opened. That's funny.
  51. IAAEP by schmiddy · · Score: 3, Insightful

    I am (well, was, at least) an Erlang Programmer. I was toying around with Erlang for some small projects with distributed programming.

    I've been looking forward to Joe's book for a long time, as he's one of the few big names in the Erlang community, and has done a lot of work (both code and, even more importantly, documentation) for the community -- first that jumps to mind is his important look at Yaws vs. apache.

    There are serious problems with the Erlang language as a whole and the community, right now. The mailing lists are actually pretty good, but quite frankly, the documentation online is terrible and the Erlang interpreter is pretty rudimentary. Not to mention basic problems with the syntax and grammar of the Erlang language itself. When I was learning Erlang a few months back, I was pretty frustrated that about the only source of documentation was on erlang.org, and they.. weren't great. For instance, there needs to be a big warning right at the beginning explaining that atomic values always start with a lowercase letter and all other variables must begin with a capital letter. This must be a huge problem for other beginners (at least, I hope I assume I wasn't alone..) compounded by the unfriendliness of the error messages produced by the Erlang interpreter.

    Now that I've switched over to doing as much as I can in Python, which has a great user community, wonderful docs, a healthy standard library, and a reasonably helpful interpreter.. I don't really worry about Erlang that much anymore. It would be wonderful if I could write, say, web crawlers (I work in web security) in Erlang. But the mysql support in Erlang looks alpha-quality at best, and AFAIK there's nothing even remotely similar to Python's urllib2 for basic web client functionality in Erlang.

    I think it says a lot that so much attention is paid to a language that is so rough around the edges, unfriendly, and lacking in documentation. Even given all that.. the ease of use of the concurrency and message passing in Erlang is so fantastic that it almost makes up for the rough spots.

    On a final note, I'd like to point out to anyone interested that I think there's a huge void out there for a language that's as easy to use and learn as Python, but with the concurrency and message passing in Erlang. It actually might not take that much work to build a network-transparent message passing interface as a Python module (I've looked into Pyro a bit.. it looks rather cumbersome and makes easy things too hard, correct me if I'm wrong). Also, modern languages need basic support for splitting up the workloads of map() or similar trivially parallelizable functions across multiple processors/cores (I know the Perl6 group was thinking about this.. not sure if this works in Parrot now or what). Basically, modern languages like Python/Perl/Ruby should really think more about making simple modules to mimic the message passing that Erlang has. Really, a little bit of code could go a long way. The Google team put together sawzall which looks kind of cool, on this note..

    --
    http://cltracker.net -- powerful craigslist multi-city search
    1. Re:IAAEP by yanagasawa · · Score: 1

      "On a final note, I'd like to point out to anyone interested that I think there's a huge void out there for a language that's as easy to use and learn as Python, but with the concurrency and message passing in Erlang."

      One of the main aspects of Erlang that makes this possible is the fact that it is a functional language with no side effects. Trying to plug the Erlang concurrency and message passing model to a non-functional language is going to be messy and a PIA to use.

    2. Re:IAAEP by DaveTerrell · · Score: 1

      As far as I can tell, you didn't learn literally the first thing about the language (atoms and Variables), couldn't figure out a single error message, and are still mad about it.

      As someone who has been doing this for only a couple of months, I think you're doing yourself a disservice. Erlang is a really powerful language that is pretty dang easy to program in once you get the basics.

      Regarding the documentation, the one thing you complain about is explained in the erlang manual. click on getting started, modules and functions. it's section 2.2.

      I will admit that exception traces took me a while to get used to, but they do make sense after a while.

  52. Re:Possibly the greatest programming book I've rea by Bill+Hayden · · Score: 1

    I can only assume you meant that sarcastically. That archaic and non-relevant book almost turned me away from CS. It was the worst textbook I encountered in college. I held on to several of my textbooks from college, but this one went in the trash.

    --
    Protect your browser with the Force Safe Search add-on
  53. Re:Possibly the greatest programming book I've rea by 00lmz · · Score: 1

    I think SICP is a good book, but some people don't think it's good as an introduction:

    The Structure and Interpretation of the Computer Science Curriculum

    Abstract:

    Twenty years ago Abelson and Sussman's Structure and Interpretation of Computer Programs radically changed the intellectual landscape of introductory computing courses. Instead of teaching some currently fashionable programming language, it employed Scheme and functional programming to teach important ideas. Introductory courses based on the book showed up around the world and made Scheme and functional programming popular. Unfortunately, these courses quickly disappeared again due to shortcomings of the book and the whimsies of Scheme. Worse, the experiment left people with a bad impression of Scheme and functional programming in general. In this pearl, we propose an alternative role for functional programming in the first-year curriculum. Specifically, we present a framework for discussing the first-year curriculum and, based on it, the design rationale for our book and course, dubbed How to Design Programs. The approach emphasizes the systematic design of programs. Experience shows that it works extremely well as a preparation for a course on object-oriented programming.

  54. Nitpick concerning the name by Vintermann · · Score: 1

    Erlang does not stand for Ericsson Language, it's named after the Danish engineer Agner Krarup Erlang. They say the duality is intentional, though.

    --
    xkcd is not in the sudoers file. This incident will be reported.
  55. I use it everyday... by Anonymous Coward · · Score: 0

    I use Erlang everyday in my support role for a mobile network, and i have to say i think it's fantastic. It's concurrency is very good, its stability is very good (our applications aren;t allowed to die...) and the fact we can load patches for new service functionality without even taking the application down is invaluable.

    I'm amazed its use isn't more widespread. There's probably nearly 200 servers here running various Erlang applications. The amount of data these apps have to process is barely believable for the hardware they run on.

  56. Why abandon LISP syntax in FP? by scottsk · · Score: 1

    Why do Haskell, Erlang, Prolog, etc abandon the clean, easy-to-understand syntax of LISP? I was reading "Beautiful Code" and saw some Haskell and it looked like a mess just visually to the naked eye. A while back I tried to install a package written in Erlang and thought it was kind of ugly too. I wonder why the FP side of the universe hasn't stuck with the simple, clear syntax of LISP. The structured/OO side of the universe has standardized on C syntax (C, C++, C#, Java, Perl, etc etc etc) which may be quirky (like LISP is) but is standard and anyone who knows one can follow along code in the other. I know Common LISP and Scheme, but was so baffled by Haskell I wondered if the syntax was serious or a FP equivalent of INTERCAL. Some of these FP languages are incredibly marginal because they're inscrutable even if you've had some background in functional programming with LISP.

    1. Re:Why abandon LISP syntax in FP? by goertzenator · · Score: 1

      What those other FP languages have that Lisp doesn't is a clean concept of *pattern matching*. Sure, you can do pattern matching in Lisp (see Termite Scheme), but its much more verbose than languages that have the syntax and semantics for it built-in.

      I agree that Haskell is hard to understand, but only because it is easy to make incredibly dense code. Reading one line of Haskell can load your brain as much as reading 12 lines of anything else. ...And monads are just plain hard.

      All that said, as an intermediate Erlang programmer, I am often left yearning for the cleanliness of Haskell syntax and also for S-expressions when I get into metaprogramming.

    2. Re:Why abandon LISP syntax in FP? by Abcd1234 · · Score: 1

      the clean, easy-to-understand syntax of LISP?

      ROFL! Oh god... man... that's good. Whew!

      Wait... you *were* joking, right? I mean, sure, s-expressions are clean and consistent, which has it's merits, but easy-to-understand necessarily implies easy-to-read, and s-expressions aren't. Hell, you need a decent, paren-matching editor just to *write* the code, let alone read it...

    3. Re:Why abandon LISP syntax in FP? by ezdude · · Score: 1

      He must have been kidding, as I saw only one pair of () in his comment.

    4. Re:Why abandon LISP syntax in FP? by Anonymous Coward · · Score: 0

      With a few days of practice, you stop seeing the parens and you start seeing the tree structure. Granted, some people's brains can't seem to do it, but many initially apprehensive people change their minds if they persist at it.

    5. Re:Why abandon LISP syntax in FP? by Abcd1234 · · Score: 1

      Umm, no offense, but if your brain has to actively adapt to the language syntax, I wouldn't call it easy-to-understand. :) Further, while your mind may be able to conceptualize the program more easily as time goes by, you still need an editor to help match braces, particularly if you're trying to read code you haven't written.

      Of course, to be fair, Lisp can be made easier to read with proper formatting. But to claim it's the end-all and be-all of FP syntax is, I think, a little silly (personally, I prefer the Haskell/ML pattern matching approach... although, Haskell's tendency to provide multiple ways of expressing the exact same things can be a little irritating).

    6. Re:Why abandon LISP syntax in FP? by White+Flame · · Score: 1

      Umm, no offense, but if your brain has to actively adapt to the language syntax, I wouldn't call it easy-to-understand. :) Further, while your mind may be able to conceptualize the program more easily as time goes by, you still need an editor to help match braces, particularly if you're trying to read code you haven't written.

      Regardless of what side is argued, this is 100% linked to prior experience with languages. You had to "actively adapt" to your first programming language no matter what it was. And if your background is VB and HTML, both Lisp and Prolog-derived matching styles need mental adaptation, so it's no indicator of how "easy-to-understand" a language is.

    7. Re:Why abandon LISP syntax in FP? by Abcd1234 · · Score: 1

      I disagree. Take an extreme example: Brainfuck. Yeah, sure, you might adapt to the way the language is structured, but the very nature of it's syntax makes it difficult for a human to understand. I would argue the same is true of a language like Lisp. In my experience, the human brain has a difficult time doing things like paren matching, tracking nesting levels, etc, not because of lack of familiarity, but because it's simply a difficult task. This is why we make sure to use careful code formatting and indentation, etc, and why we've added features such as paren matching to our editors. These things add hints which make the brain's job easier. Thus, I would contend Lisp, as a language, is *not* well designed for a *human* to easily parse and comprehend.

      At least, that's been my experience. Then again, maybe it's just my brain that's particularly poor at paren matching. :)

  57. Erlang, the Movie by xteddy · · Score: 1

    It's about time, that someone posts a link to "Erlang, the Movie"! So here it comes:

    http://www.youtube.com/watch?v=uKfKtXYLG78

  58. The eternal adolescent by westlake · · Score: 1
    Authors should give away their books, and instead earn their money giving seminars and lectures

    Limiting creative, productive, activity to the young and fit.

    How many voices are silenced because they don't have the academic sinecures, the foundation grants, that will allow them to contimue to work into old age without having to perform before an audience like a trained seal?

    What is it about the Geek?

    That he is the eternal adolescent who thinks himself immortal?

    What gives him the right to say that the punishing pace of the concert tour is the only legitimate source of income for an artist. What makes hin think that you can build a house, raise a family, on the sales of a coffee mug?

  59. old skool erlang programmer by Anonymous Coward · · Score: 0

    i started on Erlang on the mainframe. As was the nature of business at the time, I moved to Erlang on the mini (AS-400), and as PCs gained popularity, n-tier client/server Erlang. After developing ErlangScript to dynamically generate my web pages, I focused on fully implemented server-side Erlang.NET. Sadly, this has all been reduced to AEAX (Asynchronus Erlang and XML) as the language du jour. These junior high whippersnappers need to remember where they came from!

  60. Re:Possibly the greatest programming book I've rea by Mikkeles · · Score: 1

    How to Design Programs is available online.

    --
    Great minds think alike; fools seldom differ.