You are not logged in.
Pages: 1
Hi all. I changed majors to computer science and learned Java last semester. However, after reading about haskell and trying it out a bit I pretty much fell in love with the language. That having been said, I am struggling with haskell. Are there any haskell tutorials aimed at people with Java experience? I've read the others and they don't really help. It also doesn't help that I'm not familiar with discrete math (I take that course next semester).
Offline
Yep. I've also read "Learn You A Haskell For Great Good." I find myself having trouble grasping certain concepts. I also have some issues with indentation. Whenever I write a program ghc will complain about indentation issues 99% of the time. Its quite maddening.
Just one of the things that confuse me:
A- gauss :: (Int, Int) -> Int
B- gauss :: Int -> Int -> Int
**Why is A different from B?
**Here's the actual function: guass min max = ((min + max) * max) `div` 2
Offline
A- gauss :: (Int, Int) -> Int
B- gauss :: Int -> Int -> Int
In A you are using Tuples to pass just an argument. http://en.wikibooks.org/wiki/Haskell/Li … les#Tuples
In B you are using two arguments. Your example uses this method.
Offline
Ah, I understand now. I think I'll read the wikibooks entry. That is one resource that I have yet to try. It seems better organized.
One last question, though: Can Haskell be object-oriented?
Offline
That's a tricky question: it depends on exactly what you take to constitute being object-oriented. You won't naturally encounter people referring to any functional languages (or the functional idioms of mixed languages) as object-oriented. People tend to regard those as contrasting paradigms. On the other hand, there are some salient similarities between OO programming and functional programming in general, and even more salient similarities between OO programming and Haskell type classes in particular.
So short answer is probably: no, but in practice we might have understood OO slightly differently so that the answer was yes.
Offline
I read some of the classes tutorial from the haskell site (A gentle intro to Haskell, sec. 5). Type classes seem fairly interesting but its a far cry from the object-oriented programming I'm used to in Java. I was always under the impression that OO and functional programming weren't mutually exclusive.
Offline
I was always under the impression that OO and functional programming weren't mutually exclusive.
Two interesting links:
1. http://www.haskell.org/haskellwiki/The_ … rogramming.
2. http://www.haskell.org/haskellwiki/OOP_vs_type_classes.
Offline
Pages: 1