Functional programming and Haskell [closed]
I come from a background of 1 year programing in html/css/javascript/jQuery
and 6 months in Java's JSP Servelets
.I am in the 2nd year of college and in the last semester of the second year I didn't passed Functional Programing course in which we were learning Haskell(maybe mostly because i mised 90% of the clases). Seems in my second year I will also have a course in witch Haskell is involved so learning just the basics wont be enough.
What I am interested in is:
-the differences between OOP programming and function programming
-what book is recommended for a beginner in functioning programing using Haskell(I cant seem to make head or tail of what the professor wrote)
-where to go to practice the language after I'm done with the book
-what can I do with Haskell and cant do in Java
-do I need a lot of Math for understanding Haskell(My college professor used a lot of math related stuff in hes course)
the diferences beetween OOP programming and function programming
From your background, you probably don't know enough about OOP for comparisons to be useful. Just forget about it and learn functional programming as itself.
what book is recomended for a beginer in functioning programing using Haskell(I cant seem to make heade or tales of what the profesor wrote)
Everyone else keeps mentioning Learn You A Haskell for a reason. :]
where to go to practice the language after I'm done with the book
On your computer? Get the compiler, get a code editor, start programming. Learning by doing is the best way.
what can I do with Haskell and cant do in Java
Trivially, nothing. Both languages are capable of doing anything you might want to do, the end.
And again, you haven't spent enough time with Java for comparing the languages to be helpful anyway, so just learn Haskell as itself.
do I need alot of Math for understanding Haskell(My coledge profesor used a lot of math related stuff in hes course)
Not really. A little bit of discrete math and formal logic helps, though, but that's the sort of stuff you should get in any CS program anyway.
If you missed most of the lectures, then I haven't got a lot of sympathy. But I'll try to help.
1: Differences in OOP and Functional: big question. For now, I would try to approach Haskell with an open mind rather than trying to understand it in terms of its difference from OOP.
2: "Learn you a Haskell" and "Real World Haskell" are both available on the Net.
3: Work through the exercises in the books. Then look at the exercises in Project Euler.
4: Both are general purpose languages, so any application can be written in both. Haskell enables greater type safety and shorter code.
5: No, but the maths helps you understand it at a deeper level. I picked up the relevant math as I went along. Look up maths terminology on Wikipedia, and don't sweat it too much.
Start with Learn You a Haskell for Great Good. Also, look at the design of the jQuery library, as many of its features are designed around functional programming techniques.
Also, I highly recommend that you spend some time brushing up on your English skills as well. In my opinion, programming is a least as much about language as it is about math. From your comments so far, I suspect that your approach to both has been somewhat sloppy. That's going to be the hardest thing to overcome. As a general rule, programming systems are quite rigorous, and one way or another you'll need to learn to be more precise in the way you organize your thoughts.
i go with the opinions above - missing lectures is a bad thing and good English is a nice skill to have.
- Of course - the already mentioned
Learn you a Haskell for great good
- is the location to start with. - Here are recordings of an exercise class in Germany, but the spoken language is English (with german accent).
- And one thing you also should be aware of is: Hoogle, one if not the greatest things when it comes to learning haskell (imho) - a type searchable documentation:
- if you search for a function that pulls out the end of a list - but you don't know the name:
hoogle: [a]-> a
lists all functions that have the given type signature -last
, which is the function you looked for, is one of them.
- if you search for a function that pulls out the end of a list - but you don't know the name:
- Another thing - helping me develop my haskell skills is - syntastic in vim, a syntax checker, which sped the "compile - check - run"-cycle up by a massive amount, and
hlint
- a linting tool, that makes code much more readable - and shows you unnecessary stuff you added to your code, I really learned stuff from tiding up my code that way. - For starting with IO - there's this great article. It is also a great introduction how experienced functional programmers think.
- And for advanced stuff and getting to know monads there is the Monad Reader recent stuff, older stuff a worthy thing to attack, I've heard, especially #13.
if you already know and like Java have a look at Clojure
精彩评论