News for hackers. Stuff that matters.
Re:What are potential disadvantages of functional programming? by fao_ on Thursday July 27, 2017 @07:54PM (#14870841)
One of the things that I really love about Erlang, is that it unrolls loops and recursion like:

  count_to_ten(n) ->
    count_to_ten(n+1);
  count_to_ten(10) ->
    done.
which is much cleaner than how the same code is presented in 99% of functional programming languages.
Re:What are potential disadvantages of functional programming? by fbonetti on Friday July 28, 2017 @09:46AM (#14874214)
That's just a combination of pattern matching and tail call optimization. That code would look exactly this same in Haskell:

    countToTen n = countToTen (n + 1)
    countToTen 10 = done
Re:What are potential disadvantages of functional programming? by dllthomas on Saturday July 29, 2017 @11:27AM (#14881652)
The 10 case would have to be first, or that's an infinite loop. Cases are checked in order. That said, the compiler will give you a warning about it.