
On Tue, Feb 11, 2003 at 08:07:42AM -0500, JJ wrote:
(My apologies if this is off topic)
Not at all!
Functional programming is completely new to me. I've been doing imperative programming for quite a while.
From my perspective, the learning curve for Haskell seems to be near vertical. I've read several things on the web, and am working my way through The Haskell School of Expression.
Any words of wisdom?
From a relative newbie to haskell (c.a. 6 months):
Haskell (and functional programming in general) requires a different way of thinking than imperative programming, which is a lot of what makes it difficult at first (the other thing being the weird syntax). The other thing to keep in mind is that due to haskell's pure functional character, things that are easy in imperative languages are often difficult or complicated in haskell, while things that are complicated in imperative languages are often simple in haskell, once you can wrap your brain around it. My recommendation, to start out, would be to try to focus on doing what is easy in haskell, which is NOT monads or IO. While in C, perl or whatever, "beginner" programs are typically 50% or more IO, what I would consider appropriate "beginner" programs in haskell would be mostly computation, with just enough IO to show you the output. On the other hand, quite contrary to this, the first haskell program I wrote was one to search and replace strings in text files, which is definitely not what haskell is best at (relative to the perl program I had written, which I was mimicking). Of course, that was because I was intentionally doing something I knew was probably painful in haskell, since if that wasn't too hard, I figured I'd go ahead and learn the language... I'm afraid I may have uselessly babbled on a bit. Mostly, my advice is to hang in there, and to try to concentrate on new ways of thinking about your problems. If you just try to program like you are used to doing, you may as well stick with an imperative language. btw, in my experience, I've found that a useful metric for how "functionally" I am thinking is the frequency with which I use map, foldl and friends. At first they seemed really confusing (and I still get couldn't tell you the difference between foldl and foldr without looking it up), but when you get used to them they can cut the quantity of code you need to write dramatically. -- David Roundy http://civet.berkeley.edu/droundy/