You are not logged in.

#1 2010-05-17 20:36:18

Diospyros
Member
Registered: 2009-03-15
Posts: 57

Would I be missing out by learning Haskell only?

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

#2 2010-05-17 21:46:45

linkmaster03
Member
Registered: 2008-12-27
Posts: 269

Re: Would I be missing out by learning Haskell only?

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

#3 2010-05-17 23:41:36

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Would I be missing out by learning Haskell only?

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

#4 2010-05-18 03:34:28

Diospyros
Member
Registered: 2009-03-15
Posts: 57

Re: Would I be missing out by learning Haskell only?

linkmaster03 wrote:

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

#5 2010-05-18 04:55:07

Berticus
Member
Registered: 2008-06-11
Posts: 731

Re: Would I be missing out by learning Haskell only?

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

#6 2010-05-18 05:00:41

wuischke
Member
From: Suisse Romande
Registered: 2007-01-06
Posts: 630

Re: Would I be missing out by learning Haskell only?

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

#7 2010-05-19 21:33:43

Diospyros
Member
Registered: 2009-03-15
Posts: 57

Re: Would I be missing out by learning Haskell only?

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?

Offline

#8 2010-05-19 22:05:22

tavianator
Member
From: Waterloo, ON, Canada
Registered: 2007-08-21
Posts: 859
Website

Re: Would I be missing out by learning Haskell only?

Diospyros wrote:
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

#9 2010-05-20 00:54:25

Zariel
Member
Registered: 2008-10-07
Posts: 446

Re: Would I be missing out by learning Haskell only?

Haskell is a scary world, much different from C. Bare that in mind.

Offline

#10 2010-05-20 02:34:47

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: Would I be missing out by learning Haskell only?

Zariel wrote:

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

Board footer

Powered by FluxBB