You are not logged in.
Hey all,
I'm pretty new to programming; I messed around with TI-BASIC for a couple of years, and I know enough C++ to use pointers and classes and basic STL functions. Lately I've been wanting to learn to do it "right".
I come from an abstract math background and I love what I've seen of Haskell so far. But most programming material I encounter online is C++, Java, Python... I realize that these are the popular languages.
Say I took the time to really learn Haskell. Would I be missing out on learning anything significant? Theory of algorithms and data structures seem very oriented toward these types of languages, and are of particular concern.
Thanks
Last edited by Diospyros (2010-05-17 20:55:23)
Offline
Learn what you find interesting, fun, and useful. You won't learn much forcing yourself to learn a language that you don't want to. If you end up not liking Haskell, you can simply stop learning it and try another language. With that, I encourage you to begin learning Haskell if it interests you.
Offline
Understanding of algorithms and data structures is important regardless of your choice of language. However, your choice of language will determine how in depth you will need to know these concepts in order to be successful with the language. More modern languages like Python or Java have enormous standard libraries full of generic structures and sort/search functions which essentially means you just need to know which to pick in a given situation as opposed to a language like C where you would have to write your own hasp map or binary tree should the need for one arise.
I'll parrot linkmaster03's notion of "learn what you enjoy". I wrote Java for school and I've done some Python and Ruby on my own. The only language I've found so far that I truly enjoy is C.
Offline
Learn what you find interesting, fun, and useful. You won't learn much forcing yourself to learn a language that you don't want to. If you end up not liking Haskell, you can simply stop learning it and try another language. With that, I encourage you to begin learning Haskell if it interests you.
Good advice, and I fully intend to follow it :-)
I certainly have nothing against C++ though, and I am genuinely interested in the science of writing really fast/efficient code. So what I mean to ask isn't really "should I go through the pain of having to learn C++", but rather "what can C++ teach me that Haskell can't?", and to some extent "how hard would it be to learn C++ having learned Haskell versus vice versa?"
Offline
well coming from C/C++/Java/PHP and anything with the C syntax, I can tell you Haskell seemed pretty difficult. Maybe I didn't put enough effort into it. There are some ideas in there that I like and will probably give it another look at some point, but it'd have to be in a year or so.
Offline
Go with Haskell, keep just one thing in mind:
The good-looking code in Haskell uses mostly (single-linked) lists and creates copies of data structures. (It's a *purely* functional programming language after all.)
Learning about other data structures and In-Place changes is something you shouldn't forget. For instance the popular "quick sort" example you find in Haskell isn't really quick sort, since it doesn't to In-Place edits. Just to avoid the "if you've got a hammer, everything looks like a nail"-problem.
Last edited by wuischke (2010-05-18 05:01:17)
Offline
Go with Haskell, keep just one thing in mind:
The good-looking code in Haskell uses mostly (single-linked) lists and creates copies of data structures. (It's a *purely* functional programming language after all.)
Learning about other data structures and In-Place changes is something you shouldn't forget. For instance the popular "quick sort" example you find in Haskell isn't really quick sort, since it doesn't to In-Place edits. Just to avoid the "if you've got a hammer, everything looks like a nail"-problem.
Thanks for the advice. Just wondering: is the Haskell solution doomed to be inherently less efficient or just a different conceptual approach?
Offline
wuischke wrote:Go with Haskell, keep just one thing in mind:
The good-looking code in Haskell uses mostly (single-linked) lists and creates copies of data structures. (It's a *purely* functional programming language after all.)
Learning about other data structures and In-Place changes is something you shouldn't forget. For instance the popular "quick sort" example you find in Haskell isn't really quick sort, since it doesn't to In-Place edits. Just to avoid the "if you've got a hammer, everything looks like a nail"-problem.Thanks for the advice. Just wondering: is the Haskell solution doomed to be inherently less efficient or just a different conceptual approach?
Mostly it's just a different conceptual approach. Functional programming is much different than imperative programming, and sadly, much less common. But of the functional languages, Haskell is easily the fastest, for a number of reasons (lazy evaluation, and GHC being very good are a couple). In plenty of cases, it gives C/C++ a run for their money. And it's fast enough to write a window manager in (xmonad).
Also, because Haskell is purely functional, copies can be implemented as shallow copies, so they aren't slow. But wuishke is right, there aren't really such things as in-place algorithms in Haskell. But with proper techniques, you can always achieve the same algorithmic complexity for any task in Haskell as you can in any other language.
Offline
Haskell is a scary world, much different from C. Bare that in mind.
Offline
Haskell is a scary world, much different from C. Bare that in mind.
Haskell and other functional languages teach one very quickly how pervasive the imperative paradigm is in languages.
Offline