Slashdot Mirror


Why Lazy Functional Programming Languages Rule

Da Massive writes "Techworld has an in-depth chat with Simon Peyton-Jones about the development of Haskell and his philosophy of do one thing, and do it well. Peyton-Jones describes his interest in lazy functional programming languages, and chats about their increasing relevance in a world with rapidly increasing multi-core CPUs and clusters. 'I think Haskell is increasingly well placed for this multi-core stuff, as I think people are increasingly going to look to languages like Haskell and say 'oh, that's where we can get some good ideas at least', whether or not it's the actual language or concrete syntax that they adopt.'"

2 of 439 comments (clear)

  1. Re:Too constrained and academic by Unending · · Score: 5, Interesting

    Very true, I did a large project in Haskell for a CS class once the three of us working on it hated the language after we were done.
    Before that we were pretty happy with Haskell, because the programming assignments leading up to the final project were all fitted to the language, but the instant we had to do something that wasn't, we realized what a mess it is.

  2. Re:Mmmm, Kay. by arevos · · Score: 5, Interesting

    The point is that there's nothing those languages can do that can't be done, often more easily, with the current crop of popular languages.

    At University, I studied SML, and came out with a opinion similar to yours concerning functional languages. But when I started to learn Haskell on my own, really learn it, I found that all the concepts in my CompSci courses that seemed so pointlessly complex before, just fell neatly into place.

    I'll give you an example of a case where my solution in Haskell to a problem was rather better than any solution I came up with in C#. A while ago I was designing a program to export some hierarchical data held in a database to XML. Because SQL resultsets are 2D grids, I needed a way of converting a 2D grid into a list of fixed-depth tree structures.

    In Haskell, the solution is two lines of code, and assuming you know Haskell pretty well, it's fairly clear as well:

    listToForest :: Eq a => [[a]] -> Forest a
    listToForest = map toBranch . groupBy ((==) `on` head) . filter (/= [])
                  where toBranch = Node . (head . head) <*> (listToForest . map tail)

    I'd be interested to see if you could mirror the functionality in one of the 'popular' languages you mentioned. Perhaps something in Java?