It's not just me then.
HN user
edifice
Scala effectively has these kinds of type declarations on every function. This article itself proves the point. Take out the :static and type decls and see.
It definitely depends on the algorithm. It also depends on the language. A lot of the difficulty of learning Haskell, for example, is in the type system. A dynamically typed FP lang like Clojure has a shallower learning curve.
You're still going to find Scala to be significantly faster on arbitrary code. It's great that there are ways to speed up key functions in Clojure now though.
Good question. My opinion is that thinking in terms of recursive transformations of immutable datastructures is just fundamentally more difficult than the imperative equivalents. My earliest exposure to recursive algorithms was in AP computer science in high school and I remember a lot of the students really struggled with them, both those with previous imperative experience and without. This extra effort can pay off over time though because it makes the overall program easier to understand and incurs fewer bugs than the imperative style. You can also avoid a lot of this if you express your functions in terms of other elemental sequence functions (map, reduce etc) instead of explicit recursion.
Doubtless others will disagree though. Maybe we don't all have the same mental strengths and weaknesses.
That's true. Scala can be pretty fast but it needs a lot of ram.
Thanks for taking the time to write this up. Detailed descriptions of real-world applications of FP languages are always welcome.
Good article. Mirrors my own experience in three ways:
1. Immutable datastructures make it a lot easier to reason about data flow and to write correct code.
2. Static typing helps write cleaner, more explicit APIs.
3. Programming effectively in a functional style is more difficult than banging out imperative code.
I wonder why they didn't try Scala. With Google's extensive Java infrastructure that seems like a more logical choice. Certainly the problems they discuss with Haskell's string handling and debugging support wouldn't be issues in Scala.